# JSON-RPC {#jsonrpc}

## Overview {#jsonrpc_overview}

SPDK implements a [JSON-RPC 2.0](http://www.jsonrpc.org/specification) server
to allow external management tools to dynamically configure SPDK components.

## Parameters

Most of the commands can take parameters. If present, parameter is validated against its domain. If this check fail
whole command will fail with response error message [Invalid params](@ref jsonrpc_error_message).

### Required parameters

These parameters are mandatory. If any required parameter is missing RPC command will fail with proper error response.

### Optional parameters

Those parameters might be omitted. If an optional parameter is present it must be valid otherwise command will fail
proper error response.

## Error response message {#jsonrpc_error_message}

Each error response will contain proper message. As much as possible the message should indicate what went wrong during
command processing.

There is ongoing effort to customize this messages but some RPC methods just return "Invalid parameters" as message body
for any kind of error.

Code   | Description
------ | -----------
-1     | Invalid state - given method exists but it is not callable in [current runtime state](@ref rpc_framework_start_init)
-32600 | Invalid request - not compliant with JSON-RPC 2.0 Specification
-32601 | Method not found
-32602 | @ref jsonrpc_invalid_params
-32603 | Internal error for e.g.: errors like out of memory
-32700 | @ref jsonrpc_parser_error

### Parser error {#jsonrpc_parser_error}

Encountered some error during parsing request like:

- the JSON object is malformed
- parameter is too long
- request is too long

### Invalid params {#jsonrpc_invalid_params}

This type of error is most common one. It mean that there is an error while processing the request like:

- Parameters decoding in RPC method handler failed because required parameter is missing.
- Unknown parameter present encountered.
- Parameter type doesn't match expected type e.g.: given number when expected a string.
- Parameter domain check failed.
- Request is valid but some other error occurred during processing request. If possible message explains the error reason nature.

## rpc.py {#rpc_py}

SPDK provides a set of Python scripts which can invoke the JSON-RPC methods described in this document.  'rpc.py' in the scripts
directory is the main script that users will invoke to execute a JSON-RPC method.

Example:

~~~bash
scripts/rpc.py bdev_nvme_attach_controller -b nvme0 -a 00:02.0 -t pcie
~~~

A brief description of each of the RPC methods and optional 'rpc.py' arguments can be viewed with:

~~~bash
scripts/rpc.py --help
~~~

A detailed description of each RPC method and its parameters is also available.  For example:

~~~bash
scripts/rpc.py bdev_nvme_attach_controller --help
~~~

### Generate JSON-RPC methods for current configuration {#jsonrpc_generate}

An initial configuration can be specified for an SPDK application via the '-c' command line parameter.
The configuration file is a JSON file containing all of the JSON-RPC method invocations necessary
for the desired configuration. Writing these files by hand is extremely tedious however, so 'rpc.py'
provides a mechanism to generate a JSON-RPC file based on the current configuration.

~~~bash
scripts/rpc.py save_config > config.json
~~~

'config.json' can then be passed to a new SPDK application using the '-c' command line parameter
to reproduce the same configuration.

### JSON-RPC batching

'rpc.py' also supports batching of multiple JSON-RPC methods with one invocation.  So instead of
calling 'rpc.py' once for each JSON-RPC method, such as:

~~~bash
scripts/rpc.py bdev_malloc_create -b malloc0 64 512
scripts/rpc.py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a
scripts/rpc.py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 malloc0
scripts/rpc.py nvmf_create_transport -t tcp
scripts/rpc.py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t tcp -a 127.0.0.1 -s 4420
~~~

you can put the following into a text file:

~~~bash
bdev_malloc_create -b malloc0 64 512
nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a
nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 malloc0
nvmf_create_transport -t tcp
nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t tcp -a 127.0.0.1 -s 4420
~~~

and then just do:

~~~bash
scripts/rpc.py < rpc.txt
~~~

### Adding external RPC methods

SPDK includes both in-tree modules as well as the ability to use external modules.  The in-tree modules include some python
scripts to ease the process of sending RPCs to in-tree modules.  External modules can utilize this same framework to add new RPC
methods as follows:

If PYTHONPATH doesn't include the location of the external RPC python script, it should be updated:

~~~bash
export PYTHONPATH=/home/user/plugin_example/
~~~

In provided location, create python module file (e.g. rpc_plugin.py) with new RPC methods.  The file should contain
spdk_rpc_plugin_initialize() method that will be called when the plugin is loaded to define new parsers for provided subparsers
argument that adds new RPC calls (subparsers.add_parser()).  The new parsers should use the client.call() method to call RPC
functions registered within the external module using the SPDK_RPC_REGISTER() macro.  Example:

~~~python
from spdk.rpc.cmd_parser import print_json


def spdk_rpc_plugin_initialize(subparsers):
    def bdev_example_create(args):
        num_blocks = (args.total_size * 1024 * 1024) // args.block_size
        print_json(args.client.bdev_example_create(num_blocks=int(num_blocks),
                                                   block_size=args.block_size,
                                                   name=args.name,
                                                   uuid=args.uuid))

    p = subparsers.add_parser('bdev_example_create',
                              help='Create an example bdev')
    p.add_argument('-b', '--name', help="Name of the bdev")
    p.add_argument('-u', '--uuid', help="UUID of the bdev")
    p.add_argument(
        'total_size', help='Size of bdev in MB (float > 0)', type=float)
    p.add_argument('block_size', help='Block size for this bdev', type=int)
    p.set_defaults(func=bdev_example_create)

    def bdev_example_delete(args):
        args.client.bdev_example_delete(name=args.name)

    p = subparsers.add_parser('bdev_example_delete',
                              help='Delete an example disk')
    p.add_argument('name', help='example bdev name')
    p.set_defaults(func=bdev_example_delete)
~~~

Finally, call the rpc.py script with '--plugin' parameter to provide above python module name:

~~~bash
./scripts/rpc.py --plugin rpc_plugin bdev_example_create 10 4096
~~~

### Converting from legacy configuration {#jsonrpc_convert}

Starting with SPDK 20.10, legacy configuration file support has been removed.
Users with extensive configuration files already running in SPDK application,
can [generate JSON-RPC for current configuration](@ref jsonrpc_generate).

If binary for deploying the application is unavailable, the legacy configuration
file can be converted to JSON-RPC using python tool:

~~~bash
./scripts/config_converter.py < config.ini > config.json
~~~

## App Framework {#jsonrpc_components_app}

### spdk_kill_instance {#rpc_spdk_kill_instance}

Send a signal to the application.

#### Parameters

{{ spdk_kill_instance_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "spdk_kill_instance",
  "params": {
    "sig_name": "SIGINT"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### framework_monitor_context_switch {#rpc_framework_monitor_context_switch}

Query, enable, or disable the context switch monitoring functionality.

#### Parameters

{{ framework_monitor_context_switch_params }}

#### Response

 Name    | Type    | Description
-------- | ------- | -----------------------------------------------
 enabled | boolean | The current state of context switch monitoring

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "framework_monitor_context_switch",
  "params": {
    "enabled": false
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "enabled": false
  }
}
~~~

### framework_start_init {#rpc_framework_start_init}

Start initialization of SPDK subsystems when it is deferred by starting SPDK application with option -w.
During its deferral some RPCs can be used to set global parameters for SPDK subsystems.
This RPC can be called only once.

#### Parameters

{{ framework_start_init_params }}

#### Response

Completion status of SPDK subsystem initialization is returned as a boolean.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "framework_start_init"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### framework_wait_init {#rpc_framework_wait_init}

Do not return until all subsystems have been initialized and the RPC system state is running.
If the application is already running, this call will return immediately. This RPC can be called at any time.

#### Parameters

{{ framework_wait_init_params }}

#### Response

Returns True when subsystems have been initialized.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "framework_wait_init"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### rpc_get_methods {#rpc_rpc_get_methods}

Get an array of supported RPC methods.

#### Parameters

{{ rpc_get_methods_params }}

#### Response

The response is an array of supported RPC methods.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "rpc_get_methods"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {% for name in all_methods | sort -%}
    "{{ name }}"{% if not loop.last %},{% endif %}
    {% endfor %}
  ]
}
~~~

### framework_get_subsystems {#rpc_framework_get_subsystems}

Get an array of name and dependency relationship of SPDK subsystems in initialization order.

#### Parameters

{{ framework_get_subsystems_params }}

#### Response

The response is an array of name and dependency relationship of SPDK subsystems in initialization order.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "framework_get_subsystems"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "subsystem": "accel",
      "depends_on": []
    },
    {
      "subsystem": "interface",
      "depends_on": []
    },
    {
      "subsystem": "net_framework",
      "depends_on": [
        "interface"
      ]
    },
    {
      "subsystem": "bdev",
      "depends_on": [
        "accel"
      ]
    },
    {
      "subsystem": "nbd",
      "depends_on": [
        "bdev"
      ]
    },
    {
      "subsystem": "nvmf",
      "depends_on": [
        "bdev"
      ]
    },
    {
      "subsystem": "scsi",
      "depends_on": [
        "bdev"
      ]
    },
    {
      "subsystem": "vhost",
      "depends_on": [
        "scsi"
      ]
    },
    {
      "subsystem": "iscsi",
      "depends_on": [
        "scsi"
      ]
    }
  ]
}
~~~

### framework_get_config {#rpc_framework_get_config}

Get current configuration of the specified SPDK framework

#### Parameters

{{ framework_get_config_params }}

#### Response

The response is current configuration of the specified SPDK subsystem.
Null is returned if it is not retrievable by the framework_get_config method and empty array is returned if it is empty.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "framework_get_config",
  "params": {
    "name": "bdev"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "params": {
        "base_bdev": "Malloc2",
        "split_size_mb": 0,
        "split_count": 2
      },
      "method": "bdev_split_create"
    },
    {
      "params": {
        "trtype": "PCIe",
        "name": "Nvme1",
        "traddr": "0000:01:00.0"
      },
      "method": "bdev_nvme_attach_controller"
    },
    {
      "params": {
        "trtype": "PCIe",
        "name": "Nvme2",
        "traddr": "0000:03:00.0"
      },
      "method": "bdev_nvme_attach_controller"
    },
    {
      "params": {
        "block_size": 512,
        "num_blocks": 131072,
        "name": "Malloc0",
        "uuid": "913fc008-79a7-447f-b2c4-c73543638c31"
      },
      "method": "bdev_malloc_create"
    },
    {
      "params": {
        "block_size": 512,
        "num_blocks": 131072,
        "name": "Malloc1",
        "uuid": "dd5b8f6e-b67a-4506-b606-7fff5a859920"
      },
      "method": "bdev_malloc_create"
    }
  ]
}
~~~

### framework_get_reactors {#rpc_framework_get_reactors}

Retrieve an array of all reactors.

#### Parameters

{{ framework_get_reactors_params }}

#### Response

The response is an array of all reactors.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "framework_get_reactors",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tick_rate": 2400000000,
    "pid": 5502,
    "reactors": [
      {
        "lcore": 0,
        "tid": 5520,
        "busy": 41289723495,
        "idle": 3624832946,
        "lw_threads": [
          {
            "name": "app_thread",
            "id": 1,
            "cpumask": "1",
            "elapsed": 44910853363
          }
        ]
      }
    ]
  }
}
~~~

### framework_set_scheduler {#rpc_framework_set_scheduler}

Select thread scheduler that will be activated.
This feature is considered as experimental.

#### Parameters

{{ framework_set_scheduler_params }}

#### Response

Completion status of the operation is returned as a boolean.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "framework_set_scheduler",
  "id": 1,
  "params": {
    "name": "static",
    "period": "1000000"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### framework_get_scheduler {#rpc_framework_get_scheduler}

Retrieve currently set scheduler name and period, along with current governor name.

#### Parameters

{{ framework_get_scheduler_params }}

#### Response

 Name               | Type   | Description
------------------- | ------ | -----------------------------------------------
 scheduler_name     |        | Current scheduler name
 scheduler_period   |        | Currently set scheduler period in microseconds
 governor_name      |        | Governor name
 scheduling_core    |        | Current scheduling core
 isolated_core_mask |        | Current isolated core mask of scheduler

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "framework_set_scheduler",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "scheduler_name": "static",
    "scheduler_period": 2800000000,
    "governor_name": "default",
    "scheduling_core": 1,
    "isolated_core_mask": "0x4"
  }
}
~~~

### framework_get_governor {#rpc_framework_get_governor}

Retrieve current governor name, power env, frequencies available and frequency set to the cpu cores.

#### Parameters

{{ framework_get_governor_params }}

#### Response

Displays the current governor name, power env, frequencies available and frequency set to the cpu cores.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "framework_get_governor",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "governor_name": "dpdk_governor",
    "module_specific": {
      "env": "amd-pstate"
    },
    "cores": [
      {
        "lcore_id": 0,
        "available_frequencies": [
          4951000,
          4948000,
          4748000,
          4744000
        ],
        "current_frequency": 4744000
      }
    ]
  }
}
~~~

### scheduler_set_options {#rpc_scheduler_set_options}

Set options for scheduler.

This RPC may only be called before SPDK subsystems have been initialized. This RPC can be called only once.

#### Parameters

{{ scheduler_set_options_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "scheduler_set_options",
  "params": {
    "scheduling_core": 1,
    "isolated_core_mask": "0x4"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### framework_enable_cpumask_locks {#rpc_framework_enable_cpumask_locks}

Enable CPU core lock files to block multiple SPDK applications from running on the same cpumask.
The CPU core locks are enabled by default, unless user specified `--disable-cpumask-locks` command
line option when launching SPDK.

This RPC may be called after locks have already been enabled, with no effect and no error response.

#### Parameters

{{ framework_enable_cpumask_locks_params }}

#### Response

true on success

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "framework_enable_cpumask_locks"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### framework_disable_cpumask_locks {#rpc_framework_disable_cpumask_locks}

Disable CPU core lock files. The locks can also be disabled during startup, when
user specifies `--disable-cpumask-locks` command line option during SPDK launch.

This RPC may be called after locks have already been disabled, with no effect and no error
response.

#### Parameters

{{ framework_disable_cpumask_locks_params }}

#### Response

true on success

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "framework_disable_cpumask_locks"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### thread_get_stats {#rpc_thread_get_stats}

Retrieve current statistics of all the threads.

#### Parameters

{{ thread_get_stats_params }}

#### Response

The response is an array of objects containing threads statistics.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "thread_get_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tick_rate": 2400000000,
    "threads": [
      {
        "name": "app_thread",
        "id": 1,
        "cpumask": "1",
        "busy": 139223208,
        "idle": 8641080608,
        "in_interrupt": false,
        "active_pollers_count": 1,
        "timed_pollers_count": 2,
        "paused_pollers_count": 0
      }
    ]
  }
}
~~~

### thread_set_cpumask {#rpc_thread_set_cpumask}

Set the cpumask of the thread to the specified value. The thread may be migrated
to one of the specified CPUs.

#### Parameters

{{ thread_set_cpumask_params }}

#### Response

Completion status of the operation is returned as a boolean.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "thread_set_cpumask",
  "id": 1,
  "params": {
    "id": "1",
    "cpumask": "1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### trace_enable_tpoint_group {#rpc_trace_enable_tpoint_group}

Enable trace on a specific tpoint group. For example "bdev" for bdev trace group,
"all" for all trace groups.

#### Parameters

{{ trace_enable_tpoint_group_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "trace_enable_tpoint_group",
  "id": 1,
  "params": {
    "name": "bdev"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### trace_disable_tpoint_group {#rpc_trace_disable_tpoint_group}

Disable trace on a specific tpoint group. For example "bdev" for bdev trace group,
"all" for all trace groups.

#### Parameters

{{ trace_disable_tpoint_group_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "trace_disable_tpoint_group",
  "id": 1,
  "params": {
    "name": "bdev"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### trace_set_tpoint_mask {#rpc_trace_set_tpoint_mask}

Enable tracepoint mask on a specific tpoint group. For example "bdev" for bdev trace group,
and 0x1 to enable the first tracepoint inside the group (BDEV_IO_START). This command will not
disable already active tracepoints or those not specified in the mask. For a full description
of all available trace groups, see
[tracepoint documentation](https://spdk.io/doc/tracepoints.html).

#### Parameters

{{ trace_set_tpoint_mask_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "trace_set_tpoint_mask",
  "id": 1,
  "params": {
    "name": "bdev",
    "tpoint_mask": "0x1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### trace_clear_tpoint_mask {#rpc_trace_clear_tpoint_mask}

Disable tracepoint mask on a specific tpoint group. For example "bdev" for bdev trace group,
and 0x1 to disable the first tracepoint inside the group (BDEV_IO_START). For a full description
of all available trace groups, see
[tracepoint documentation](https://spdk.io/doc/tracepoints.html).

#### Parameters

{{ trace_clear_tpoint_mask_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "trace_clear_tpoint_mask",
  "id": 1,
  "params": {
    "name": "bdev",
    "tpoint_mask": "0x1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### trace_get_tpoint_group_mask {#rpc_trace_get_tpoint_group_mask}

Display mask info for every group.

#### Parameters

{{ trace_get_tpoint_group_mask_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "trace_get_tpoint_group_mask",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tpoint_group_mask": "0x0",
    "iscsi_conn": {
      "enabled": false,
      "mask": "0x2"
    },
    "scsi": {
      "enabled": false,
      "mask": "0x4"
    },
    "bdev": {
      "enabled": false,
      "mask": "0x8"
    },
    "nvmf_tcp": {
      "enabled": false,
      "mask": "0x20"
    },
    "ftl": {
      "enabled": false,
      "mask": "0x40"
    }
  }
}
~~~

### trace_get_info {#rpc_trace_get_info}

Get name of shared memory file, list of the available trace point groups
and mask of the available trace points for each group

#### Parameters

{{ trace_get_info_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "trace_get_info",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tpoint_shm_path": "/dev/shm/spdk_tgt_trace.pid3071944",
    "tpoint_group_mask": "0x8",
    "iscsi_conn": {
      "mask": "0x2",
      "tpoint_mask": "0x0"
    },
    "scsi": {
      "mask": "0x4",
      "tpoint_mask": "0x0"
    },
    "bdev": {
      "mask": "0x8",
      "tpoint_mask": "0xffffffffffffffff"
    },
    "nvmf_tcp": {
      "mask": "0x20",
      "tpoint_mask": "0x0"
    },
    "thread": {
      "mask": "0x400",
      "tpoint_mask": "0x0"
    },
    "nvme_pcie": {
      "mask": "0x800",
      "tpoint_mask": "0x0"
    },
    "nvme_tcp": {
      "mask": "0x2000",
      "tpoint_mask": "0x0"
    },
    "bdev_nvme": {
      "mask": "0x4000",
      "tpoint_mask": "0x0"
    }
  }
}
~~~

### log_set_print_level {#rpc_log_set_print_level}

Set the current level at which output will additionally be
sent to the current console.

#### Parameters

{{ log_set_print_level_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "log_set_print_level",
  "id": 1,
  "params": {
    "level": "ERROR"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### log_get_print_level {#rpc_log_get_print_level}

Get the current level at which output will additionally be
sent to the current console.

#### Parameters

{{ log_get_print_level_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "log_get_print_level",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "NOTICE"
}
~~~

### log_set_level {#rpc_log_set_level}

Set the current logging level output by the `log` module.

#### Parameters

{{ log_set_level_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "log_set_level",
  "id": 1,
  "params": {
    "level": "ERROR"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### log_get_level {#rpc_log_get_level}

Get the current logging level output by the `log` module.

#### Parameters

{{ log_get_level_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "log_get_level",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "NOTICE"
}
~~~

### log_set_flag {#rpc_log_set_flag}

Enable logging for specific portions of the application. The list of possible
log flags can be obtained using the `log_get_flags` RPC and may be different
for each application.

#### Parameters

{{ log_set_flag_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "log_set_flag",
  "id": 1,
  "params": {
    "flag": "all"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### log_clear_flag {#rpc_log_clear_flag}

Disable logging for specific portions of the application. The list of possible
log flags can be obtained using the `log_get_flags` RPC and may be different
for each application.

#### Parameters

{{ log_clear_flag_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "log_clear_flag",
  "id": 1,
  "params": {
    "flag": "all"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### log_get_flags {#rpc_log_get_flags}

Get the list of valid flags for this application and whether
they are currently enabled.

#### Parameters

{{ log_get_flags_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "log_get_flags",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "nvmf": true,
    "nvme": true,
    "aio": false,
    "bdev": false
  }
}
~~~

### log_enable_timestamps {#rpc_log_enable_timestamps}

Enable or disable timestamps.

#### Parameters

{{ log_enable_timestamps_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "log_enable_timestamps",
  "id": 1,
  "params": {
    "enabled": true
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### thread_get_pollers {#rpc_thread_get_pollers}

Retrieve current pollers of all the threads.

#### Parameters

{{ thread_get_pollers_params }}

#### Response

The response is an array of objects containing pollers of all the threads.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "thread_get_pollers",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tick_rate": 2500000000,
    "threads": [
      {
        "name": "app_thread",
        "id": 1,
        "active_pollers": [],
        "timed_pollers": [
          {
            "name": "spdk_rpc_subsystem_poll",
            "id": 1,
            "state": "waiting",
            "run_count": 12345,
            "busy_count": 10000,
            "period_ticks": 10000000
          }
        ],
        "paused_pollers": []
      }
    ]
  }
}
~~~

### thread_get_io_channels {#rpc_thread_get_io_channels}

Retrieve current IO channels of all the threads.

#### Parameters

{{ thread_get_io_channels_params }}

#### Response

The response is an array of objects containing IO channels of all the threads.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "thread_get_io_channels",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tick_rate": 2500000000,
    "threads": [
      {
        "name": "app_thread",
        "io_channels": [
          {
            "name": "nvmf_tgt",
            "ref": 1
          }
        ]
      }
    ]
  }
}
~~~

### env_dpdk_get_mem_stats {#rpc_env_dpdk_get_mem_stats}

Write the dpdk memory stats to a file.

#### Parameters

{{ env_dpdk_get_mem_stats_params }}

#### Response

The response is a pathname to a text file containing the memory stats.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "env_dpdk_get_mem_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "filename": "/tmp/spdk_mem_dump.txt"
  }
}
~~~

## Acceleration Framework Layer {#jsonrpc_components_accel_fw}

### accel_get_module_info {#rpc_accel_get_module_info}

Get a list of valid module names and their supported operations.

#### Parameters

{{ accel_get_module_info_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_get_module_info",
  "id": 1
}
~~~

Example response:

~~~json
[
  {
    "module": "software",
    "supported ops": [
      "copy",
      "fill",
      "dualcast",
      "compare",
      "crc32c",
      "copy_crc32c",
      "compress",
      "decompress"
    ]
  },
  {
    "module": "dsa",
    "supported ops": [
      "copy",
      "fill",
      "dualcast",
      "compare",
      "crc32c",
      "copy_crc32c"
    ]
  }
]
~~~

### accel_get_opc_assignments {#rpc_accel_get_opc_assignments}

Get a list of opcode names and their assigned accel_fw modules.

#### Parameters

{{ accel_get_opc_assignments_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_get_opc_assignments",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "copy": "software",
      "fill": "software",
      "dualcast": "software",
      "compare": "software",
      "crc32c": "software",
      "copy_crc32c": "software",
      "compress": "software",
      "decompress": "software"
    }
  ]
}
~~~

### accel_assign_opc {#rpc_accel_assign_opc}

Manually assign an operation to a module.

#### Parameters

{{ accel_assign_opc_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_assign_opc",
  "id": 1,
  "params": {
    "opname": "copy",
    "module": "software"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### accel_crypto_key_create {#rpc_accel_crypto_key_create}

Create a crypto key which will be used in accel framework

#### Parameters

{{ accel_crypto_key_create_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_crypto_key_create",
  "id": 1,
  "params": {
    "cipher": "AES_XTS",
    "key": "00112233445566778899001122334455",
    "key2": "00112233445566778899001122334455",
    "tweak_mode": "SIMPLE_LBA",
    "name": "super_key"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### accel_crypto_key_destroy {#rpc_accel_crypto_key_destroy}

Destroy a crypto key. The user is responsible for ensuring that the deleted key is not used by acceleration modules.

#### Parameters

{{ accel_crypto_key_destroy_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_crypto_key_destroy",
  "id": 1,
  "params": {
    "name": "super_key"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### accel_crypto_keys_get {#rpc_accel_crypto_keys_get}

Get information about existing crypto keys

#### Parameters

{{ accel_crypto_keys_get_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_crypto_keys_get",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "test_dek",
      "cipher": "AES_XTS",
      "key": "00112233445566778899001122334455",
      "key2": "11223344556677889900112233445500",
      "tweak_mode": "SIMPLE_LBA"
    },
    {
      "name": "test_dek2",
      "cipher": "AES_XTS",
      "key": "11223344556677889900112233445500",
      "key2": "22334455667788990011223344550011",
      "tweak_mode": "SIMPLE_LBA"
    }
  ]
}
~~~

### accel_set_driver {#rpc_accel_set_driver}

Select platform driver to execute operation chains.  Until a driver is selected, all operations are
executed through accel modules.

#### Parameters

{{ accel_set_driver_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_set_driver",
  "id": 1,
  "params": {
    "name": "xeon"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### accel_set_options {#rpc_accel_set_options}

Set accel framework's options.

#### Parameters

{{ accel_set_options_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_set_options",
  "id": 1,
  "params": {
    "small_cache_size": 128,
    "large_cache_size": 32
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### accel_get_stats {#rpc_accel_get_stats}

Retrieve accel framework's statistics.  Statistics for opcodes that have never been executed (i.e.
all their stats are at 0) aren't included in the `operations` array.

#### Parameters

{{ accel_get_stats_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_get_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "sequence_executed": 256,
    "sequence_failed": 0,
    "operations": [
      {
        "opcode": "copy",
        "executed": 256,
        "failed": 0
      },
      {
        "opcode": "encrypt",
        "executed": 128,
        "failed": 0
      },
      {
        "opcode": "decrypt",
        "executed": 128,
        "failed": 0
      }
    ]
  }
}
~~~

### accel_error_inject_error {#rpc_accel_error_inject_error}

Inject an error to execution of a given operation.  Note, that in order for the errors to be
actually injected, the error module must be assigned to that operation via `accel_assign_opc`.

#### Parameters

{{ accel_error_inject_error_params }}

#### Example

Example request:

~~~json
{
  "method": "accel_error_inject_error",
  "params": {
    "opcode": "crc32c",
    "type": "corrupt",
    "count": 10000,
    "interval": 8
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### compressdev_scan_accel_module {#rpc_compressdev_scan_accel_module}

Set config and enable compressdev accel module offload.
Select the DPDK polled mode driver (pmd) for the accel compress module,
0 = auto-select, 1= QAT only, 2 = mlx5_pci only, 3 = uadk only.

#### Parameters

{{ compressdev_scan_accel_module_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "pmd": 1
  },
  "jsonrpc": "2.0",
  "method": "compressdev_scan_accel_module",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### dsa_scan_accel_module {#rpc_dsa_scan_accel_module}

Set config and enable dsa accel module offload.
This feature is considered as experimental.

#### Parameters

{{ dsa_scan_accel_module_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "config_kernel_mode": false
  },
  "jsonrpc": "2.0",
  "method": "dsa_scan_accel_module",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iaa_scan_accel_module {#rpc_iaa_scan_accel_module}

Enable IAA accel module offload.
This feature is considered as experimental.

#### Parameters

{{ iaa_scan_accel_module_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iaa_scan_accel_module",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### ioat_scan_accel_module {#rpc_ioat_scan_accel_module}

Enable ioat accel module offload.

#### Parameters

{{ ioat_scan_accel_module_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "ioat_scan_accel_module",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### cuda_scan_accel_module {#rpc_cuda_scan_accel_module}

Enable cuda accel module offload.

#### Parameters

{{ cuda_scan_accel_module_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "cuda_scan_accel_module",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### dpdk_cryptodev_scan_accel_module {#rpc_dpdk_cryptodev_scan_accel_module}

Enable dpdk_cryptodev accel offload

#### Parameters

{{ dpdk_cryptodev_scan_accel_module_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "dpdk_cryptodev_scan_accel_module",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### dpdk_cryptodev_set_driver {#rpc_dpdk_cryptodev_set_driver}

Set the DPDK cryptodev driver

#### Parameters

{{ dpdk_cryptodev_set_driver_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "dpdk_cryptodev_set_driver",
  "id": 1,
  "params": {
    "crypto_pmd": "crypto_aesni_mb"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### dpdk_cryptodev_get_driver {#rpc_dpdk_cryptodev_get_driver}

Get the DPDK cryptodev driver

#### Parameters

{{ dpdk_cryptodev_get_driver_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "dpdk_cryptodev_get_driver",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "crypto_aesni_mb"
}
~~~

### mlx5_scan_accel_module {#rpc_mlx5_scan_accel_module}

Enable mlx5 accel offload

#### Parameters

{{ mlx5_scan_accel_module_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "mlx5_scan_accel_module",
  "id": 1,
  "params": {
    "qp_size": 256,
    "num_requests": 2047
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### accel_mlx5_dump_stats {#rpc_accel_mlx5_dump_stats}

Dump mlx5 accel module statistics

#### Parameters

{{ accel_mlx5_dump_stats_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_mlx5_dump_stats",
  "id": 1,
  "params": {
    "level": "total"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "total": {
      "umrs": {
        "crypto_umrs": 1234,
        "sig_umrs": 2345,
        "total": 3579
      },
      "rdma": {
        "read": 0,
        "write": 7035,
        "total": 7035
      },
      "polling": {
        "polls": 1096,
        "idle_polls": 300,
        "completions": 7035,
        "idle_polls_percentage": 36.5,
        "cpls_per_poll": 6.418,
        "nomem_qdepth": 0,
        "nomem_mkey": 0
      },
      "tasks": {
        "copy": 0,
        "crypto": 1234,
        "crc32c": 2345,
        "total": 3579
      }
    }
  }
}
~~~

## Block Device Abstraction Layer {#jsonrpc_components_bdev}

### bdev_set_options {#rpc_bdev_set_options}

Set global parameters for the block device (bdev) subsystem.  This RPC may only be called
before SPDK subsystems have been initialized.

#### Parameters

{{ bdev_set_options_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_set_options",
  "params": {
    "bdev_io_pool_size": 65536,
    "bdev_io_cache_size": 256
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_get_bdevs {#rpc_bdev_get_bdevs}

Get information about block devices (bdevs).

#### Parameters

The user may specify no parameters in order to list all block devices, or a block device may be
specified by name.  If a timeout is specified, the method will block until a bdev with a specified
name appears or the timeout expires.  By default, the timeout is zero, meaning the method returns
immediately whether the bdev exists or not.

{{ bdev_get_bdevs_params }}

#### Response

The response is an array of objects containing information about the requested block devices.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_get_bdevs",
  "params": {
    "name": "Malloc0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "Malloc0",
      "product_name": "Malloc disk",
      "block_size": 512,
      "num_blocks": 20480,
      "claimed": false,
      "zoned": false,
      "supported_io_types": {
        "read": true,
        "write": true,
        "unmap": true,
        "write_zeroes": true,
        "flush": true,
        "reset": true,
        "nvme_admin": false,
        "nvme_io": false
      },
      "driver_specific": {}
    }
  ]
}
~~~

### bdev_examine {#rpc_bdev_examine}

Request that the bdev layer examines the given bdev for metadata and creates
new bdevs if metadata is found. This is only necessary if `auto_examine` has
been set to false using `bdev_set_options`. By default, `auto_examine` is true
and bdev examination is automatic.

#### Parameters

{{ bdev_examine_params }}

#### Response

The response is an array of objects containing I/O statistics of the requested block devices.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_examine",
  "params": {
    "name": "Nvme0n1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_wait_for_examine {#rpc_bdev_wait_for_examine}

Report when all bdevs have been examined by every bdev module.

#### Parameters

{{ bdev_wait_for_examine_params }}

#### Response

The response is sent when all bdev modules had a chance to examine every bdev.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_wait_for_examine",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_get_iostat {#rpc_bdev_get_iostat}

Get I/O statistics of block devices (bdevs).

#### Parameters

The user may specify no parameters in order to list all block devices, or a block device may be
specified by name.

{{ bdev_get_iostat_params }}

#### Response

The response is an array of objects containing I/O statistics of the requested block devices.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_get_iostat",
  "params": {
    "names": ["Nvme0n1", "Nvme0n2"],
    "per_channel": false
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tick_rate": 2200000000,
    "bdevs": [
      {
        "name": "Nvme0n1",
        "bytes_read": 36864,
        "num_read_ops": 2,
        "bytes_written": 0,
        "num_write_ops": 0,
        "bytes_unmapped": 0,
        "num_unmap_ops": 0,
        "read_latency_ticks": 178904,
        "write_latency_ticks": 0,
        "unmap_latency_ticks": 0,
        "queue_depth_polling_period": 2,
        "queue_depth": 0,
        "io_time": 0,
        "weighted_io_time": 0
      },
      {
        "name": "Nvme0n2",
        "bytes_read": 36864,
        "num_read_ops": 2,
        "bytes_written": 0,
        "num_write_ops": 0,
        "bytes_unmapped": 0,
        "num_unmap_ops": 0,
        "read_latency_ticks": 178904,
        "write_latency_ticks": 0,
        "unmap_latency_ticks": 0,
        "queue_depth_polling_period": 2,
        "queue_depth": 0,
        "io_time": 0,
        "weighted_io_time": 0
      }
    ]
  }
}
~~~

### bdev_reset_iostat {#rpc_bdev_reset_iostat}

Reset I/O statistics of block devices (bdevs). Note that if one consumer resets I/O statistics,
it affects all other consumers.

#### Parameters

The user may specify no parameters in order to reset I/O statistics for all block devices, or
a block device may be specified by name.

{{ bdev_reset_iostat_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_reset_iostat",
  "params": {
    "name": "Nvme0n1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_enable_histogram {#rpc_bdev_enable_histogram}

Control whether collecting data for histogram is enabled for specified bdev.

#### Parameters

{{ bdev_enable_histogram_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_enable_histogram",
  "params": {
    "name": "Nvme0n1",
    "enable": true,
    "opc": "read",
    "granularity": 7,
    "min_nsec": 1000,
    "max_nsec": 1000000000
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_get_histogram {#rpc_bdev_get_histogram}

Get latency histogram for specified bdev.

#### Parameters

{{ bdev_get_histogram_params }}

#### Response

 Name        | Type   | Description
------------ | ------ | -------------------------------------
 histogram   |        | Base64 encoded histogram
 granularity |        | Granularity of the histogram buckets
 min_range   |        | Minimal range tracked in histogram
 max_range   |        | Maximal range tracked in histogram
 tsc_rate    |        | Ticks per second

#### Example

Note that histogram field is trimmed, actual encoded histogram length is ~80kb.

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_get_histogram",
  "params": {
    "name": "Nvme0n1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "histogram": "AAAAAAAAAAAAAA...AAAAAAAAA==",
    "granularity": 7,
    "min_range": 5,
    "max_range": 25,
    "tsc_rate": 2300000000
  }
}
~~~

### bdev_set_qos_limit {#rpc_bdev_set_qos_limit}

Set the quality of service rate limit on a bdev.

#### Parameters

{{ bdev_set_qos_limit_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_set_qos_limit",
  "params": {
    "name": "Malloc0",
    "rw_ios_per_sec": 20000,
    "rw_mbytes_per_sec": 100,
    "r_mbytes_per_sec": 50,
    "w_mbytes_per_sec": 50
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_set_qd_sampling_period {#rpc_bdev_set_qd_sampling_period}

Enable queue depth tracking on a specified bdev.

#### Parameters

{{ bdev_set_qd_sampling_period_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_set_qd_sampling_period",
  "id": 1,
  "params": {
    "name": "Malloc0",
    "period": 20
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_crypto_create {#rpc_bdev_crypto_create}

Create a new crypto bdev on a given base bdev.

#### Parameters

Both key and key2 must be passed in the hexlified form. For example, 256bit AES key may look like this:
afd9477abf50254219ccb75965fbe39f23ebead5676e292582a0a67f66b88215

{{ bdev_crypto_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "base_bdev_name": "Nvme0n1",
    "name": "my_crypto_bdev",
    "crypto_pmd": "crypto_aesni_mb",
    "key": "12345678901234561234567890123456",
    "cipher": "AES_CBC"
  },
  "jsonrpc": "2.0",
  "method": "bdev_crypto_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "my_crypto_bdev"
}
~~~

### bdev_crypto_delete {#rpc_bdev_crypto_delete}

Delete a crypto bdev.

#### Parameters

{{ bdev_crypto_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "my_crypto_bdev"
  },
  "jsonrpc": "2.0",
  "method": "bdev_crypto_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ocf_create {#rpc_bdev_ocf_create}

Construct new OCF bdev.
Command accepts cache mode that is going to be used.
You can find more details about supported cache modes in the [OCF documentation](https://open-cas.github.io/cache_configuration.html#cache-mode)

#### Parameters

{{ bdev_ocf_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ocf0",
    "mode": "wt",
    "cache_line_size": 64,
    "cache_bdev_name": "Nvme0n1",
    "core_bdev_name": "aio0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ocf_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "ocf0"
}
~~~

### bdev_ocf_delete {#rpc_bdev_ocf_delete}

Delete the OCF bdev

#### Parameters

{{ bdev_ocf_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ocf0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ocf_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ocf_get_stats {#rpc_bdev_ocf_get_stats}

Get statistics of chosen OCF block device.

#### Parameters

{{ bdev_ocf_get_stats_params }}

#### Response

Statistics as json object.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ocf0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ocf_get_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "usage": {
        "clean": {
          "count": 76033,
          "units": "4KiB blocks",
          "percentage": "100.0"
        },
        "free": {
          "count": 767,
          "units": "4KiB blocks",
          "percentage": "0.9"
        },
        "occupancy": {
          "count": 76033,
          "units": "4KiB blocks",
          "percentage": "99.0"
        },
        "dirty": {
          "count": 0,
          "units": "4KiB blocks",
          "percentage": "0.0"
        }
      }
    },
    {
      "requests": {
        "rd_total": {
          "count": 2,
          "units": "Requests",
          "percentage": "0.0"
        },
        "wr_full_misses": {
          "count": 76280,
          "units": "Requests",
          "percentage": "35.6"
        },
        "rd_full_misses": {
          "count": 1,
          "units": "Requests",
          "percentage": "0.0"
        },
        "rd_partial_misses": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "wr_total": {
          "count": 212416,
          "units": "Requests",
          "percentage": "99.2"
        },
        "wr_pt": {
          "count": 1535,
          "units": "Requests",
          "percentage": "0.7"
        },
        "wr_partial_misses": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "serviced": {
          "count": 212418,
          "units": "Requests",
          "percentage": "99.2"
        },
        "rd_pt": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "total": {
          "count": 213953,
          "units": "Requests",
          "percentage": "100.0"
        },
        "rd_hits": {
          "count": 1,
          "units": "Requests",
          "percentage": "0.0"
        },
        "wr_hits": {
          "count": 136136,
          "units": "Requests",
          "percentage": "63.6"
        }
      }
    },
    {
      "errors": {
        "total": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "cache_obj_total": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "core_obj_total": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "cache_obj_rd": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "core_obj_wr": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "core_obj_rd": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        },
        "cache_obj_wr": {
          "count": 0,
          "units": "Requests",
          "percentage": "0.0"
        }
      }
    },
    {
      "blocks": {
        "volume_rd": {
          "count": 9,
          "units": "4KiB blocks",
          "percentage": "0.0"
        },
        "volume_wr": {
          "count": 213951,
          "units": "4KiB blocks",
          "percentage": "99.9"
        },
        "cache_obj_total": {
          "count": 212425,
          "units": "4KiB blocks",
          "percentage": "100.0"
        },
        "core_obj_total": {
          "count": 213959,
          "units": "4KiB blocks",
          "percentage": "100.0"
        },
        "cache_obj_rd": {
          "count": 1,
          "units": "4KiB blocks",
          "percentage": "0.0"
        },
        "core_obj_wr": {
          "count": 213951,
          "units": "4KiB blocks",
          "percentage": "99.9"
        },
        "volume_total": {
          "count": 213960,
          "units": "4KiB blocks",
          "percentage": "100.0"
        },
        "core_obj_rd": {
          "count": 8,
          "units": "4KiB blocks",
          "percentage": "0.0"
        },
        "cache_obj_wr": {
          "count": 212424,
          "units": "4KiB blocks",
          "percentage": "99.9"
        }
      }
    }
  ]
}
~~~

### bdev_ocf_reset_stats {#rpc_bdev_ocf_reset_stats}

Reset statistics of chosen OCF block device.

#### Parameters

{{ bdev_ocf_reset_stats_params }}

#### Response

Completion status of reset statistics operation returned as a boolean.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ocf0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ocf_reset_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ocf_get_bdevs {#rpc_bdev_ocf_get_bdevs}

Get list of OCF devices including unregistered ones.

#### Parameters

{{ bdev_ocf_get_bdevs_params }}

#### Response

Array of OCF devices with their current status, along with core and cache bdevs.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_ocf_get_bdevs",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "PartCache",
      "started": false,
      "cache": {
        "name": "Malloc0",
        "attached": true
      },
      "core": {
        "name": "Malloc1",
        "attached": false
      }
    }
  ]
}
~~~

### bdev_ocf_set_cache_mode {#rpc_bdev_ocf_set_cache_mode}

Set new cache mode on OCF bdev.

#### Parameters

{{ bdev_ocf_set_cache_mode_params }}

#### Response

New cache mode name.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ocf0",
    "mode": "pt"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ocf_set_cache_mode",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "pt"
}
~~~

### bdev_ocf_set_seqcutoff {#rpc_bdev_ocf_set_seqcutoff}

Set sequential cutoff parameters on all cores for the given OCF cache device.
A brief description of this functionality can be found in [OpenCAS documentation](https://open-cas.github.io/guide_tool_details.html#seq-cutoff).

#### Parameters

{{ bdev_ocf_set_seqcutoff_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ocf0",
    "policy": "full",
    "threshold": 4,
    "promotion_count": 2
  },
  "jsonrpc": "2.0",
  "method": "bdev_ocf_set_seqcutoff",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ocf_flush_start {#rpc_bdev_ocf_flush_start}

Start flushing OCF cache device.

Automatic flushes of dirty data are managed by OCF cleaning policy settings.
In addition to that, all dirty data is flushed to core device when there is
an attempt to stop caching.
On the other hand, this RPC call gives a possibility to flush dirty data manually
when there is a need for it, e.g. to speed up the shutdown process when data
hasn't been flushed for a long time.
This RPC returns immediately, and flush is then being performed in the
background. To see the status of flushing operation use bdev_ocf_flush_status.

#### Parameters

{{ bdev_ocf_flush_start_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ocf0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ocf_flush_start",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ocf_flush_status {#rpc_bdev_ocf_flush_status}

Get flush status of OCF cache device.

Automatic flushes of dirty data are managed by OCF cleaning policy settings.
In addition to that, all dirty data is flushed to core device when there is
an attempt to stop caching.
On the other hand, there is a possibility to flush dirty data manually
when there is a need for it, e.g. to speed up the shutdown process when data
hasn't been flushed for a long time.
This RPC reports if such manual flush is still in progress and if the operation
was successful. To start manual flush use bdev_ocf_flush_start.

#### Parameters

{{ bdev_ocf_flush_status_params }}

#### Response

Status of OCF cache device flush.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ocf0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ocf_flush_status",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "in_progress": false,
    "status": 0
  }
}
~~~

### bdev_malloc_create {#rpc_bdev_malloc_create}

Construct @ref bdev_config_malloc

The `dif_type` parameter can have 0, 1, 2, or 3, and controls the check of the guard tag and the reference tag.
If the `dif_type` is 1, 2, or 3, the malloc bdev compares the guard tag to the CRC-16 computed over the block data.
If the `dif_type` is 1 or 2, the malloc bdev compares the reference tag to the computed reference tag.
The computed reference tag for the first block of the I/O is the `init_ref_tag` of the DIF context, and
the computed reference tag is incremented for each subsequent block.
If the `dif_type` is 3, the malloc bdev does not check the reference tag.
The application tag is not checked by the malloc bdev because the current block device API does not expose
it to the upper layer yet.

#### Parameters

{{ bdev_malloc_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "block_size": 4096,
    "num_blocks": 16384,
    "name": "Malloc0",
    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90",
    "optimal_io_boundary": 16
  },
  "jsonrpc": "2.0",
  "method": "bdev_malloc_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Malloc0"
}
~~~

### bdev_malloc_delete {#rpc_bdev_malloc_delete}

Delete @ref bdev_config_malloc

#### Parameters

{{ bdev_malloc_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Malloc0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_malloc_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_null_create {#rpc_bdev_null_create}

Construct @ref bdev_config_null

#### Parameters

{{ bdev_null_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "block_size": 4104,
    "num_blocks": 16384,
    "name": "Null0",
    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90",
    "md_size": 8,
    "dif_type": 1,
    "dif_is_head_of_md": true,
    "preferred_write_granularity": 64,
    "preferred_write_alignment": 64,
    "optimal_write_size": 4,
    "preferred_unmap_granularity": 16,
    "preferred_unmap_alignment": 16
  },
  "jsonrpc": "2.0",
  "method": "bdev_null_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Null0"
}
~~~

### bdev_null_delete {#rpc_bdev_null_delete}

Delete @ref bdev_config_null.

#### Parameters

{{ bdev_null_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Null0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_null_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_null_resize {#rpc_bdev_null_resize}

Resize @ref bdev_config_null.

#### Parameters

{{ bdev_null_resize_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Null0",
    "new_size": 4096
  },
  "jsonrpc": "2.0",
  "method": "bdev_null_resize",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_aio_create {#rpc_bdev_aio_create}

Construct @ref bdev_config_aio.

#### Parameters

{{ bdev_aio_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "block_size": 4096,
    "name": "Aio0",
    "filename": "/tmp/aio_bdev_file"
  },
  "jsonrpc": "2.0",
  "method": "bdev_aio_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Aio0"
}
~~~

### bdev_aio_rescan {#rpc_bdev_aio_rescan}

Rescan the size of @ref bdev_config_aio.

#### Parameters

{{ bdev_aio_rescan_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Aio0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_aio_rescan",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_aio_delete {#rpc_bdev_aio_delete}

Delete @ref bdev_config_aio.

#### Parameters

{{ bdev_aio_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Aio0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_aio_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_set_options {#rpc_bdev_nvme_set_options}

Set global parameters for all bdev NVMe. This RPC may only be called before SPDK subsystems have been initialized
or any bdev NVMe has been created.

Parameters, ctrlr_loss_timeout_sec, reconnect_delay_sec, and fast_io_fail_timeout_sec, are for I/O error resiliency.
They can be overridden if they are given by the RPC bdev_nvme_attach_controller.

#### Parameters

{{ bdev_nvme_set_options_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "transport_retry_count": 5,
    "arbitration_burst": 3,
    "low_priority_weight": 8,
    "medium_priority_weight": 8,
    "high_priority_weight": 8,
    "nvme_adminq_poll_period_us": 2000,
    "timeout_us": 10000000,
    "timeout_admin_us": 20000000,
    "keep_alive_timeout_ms": 600000,
    "action_on_timeout": "reset",
    "io_queue_requests": 2048,
    "delay_cmd_submit": true,
    "dhchap_digests": [
      "sha384",
      "sha512"
    ],
    "dhchap_dhgroups": [
      "ffdhe6144",
      "ffdhe8192"
    ],
    "rdma_umr_per_io": false
  },
  "jsonrpc": "2.0",
  "method": "bdev_nvme_set_options",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_set_hotplug {#rpc_bdev_nvme_set_hotplug}

Change settings of the NVMe hotplug feature. If enabled, PCIe NVMe bdevs will be automatically discovered on insertion
and deleted on removal.

#### Parameters

{{ bdev_nvme_set_hotplug_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "enable": true,
    "period_us": 2000
  },
  "jsonrpc": "2.0",
  "method": "bdev_nvme_set_hotplug",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_attach_controller {#rpc_bdev_nvme_attach_controller}

Construct @ref bdev_config_nvme. This RPC can also be used to add additional paths to an existing controller to enable
multipathing. This is done by specifying the `name` parameter as an existing controller. When adding an additional
path, the hostnqn, hostsvcid, hostaddr, prchk_reftag, and prchk_guard_arguments must not be specified and are assumed
to have the same value as the existing path.

The parameters, `ctrlr_loss_timeout_sec`, `reconnect_delay_sec`, and `fast_io_fail_timeout_sec`, are mutually dependent.
If `reconnect_delay_sec` is non-zero, `ctrlr_loss_timeout_sec` has to be -1 or not less than `reconnect_delay_sec`.
If `reconnect_delay_sec` is zero, `ctrlr_loss_timeout_sec` has to be zero.
If `fast_io_fail_timeout_sec` is not zero, it has to be not less than `reconnect_delay_sec` and less than `ctrlr_loss_timeout_sec` if `ctrlr_loss_timeout_sec` is not -1.

#### Parameters

{{ bdev_nvme_attach_controller_params }}

#### Response

Array of names of newly created bdevs.

#### Example

Example request:

~~~json
{
  "params": {
    "trtype": "pcie",
    "name": "Nvme0",
    "traddr": "0000:0a:00.0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_nvme_attach_controller",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "Nvme0n1"
  ]
}
~~~

### bdev_nvme_get_controllers {#rpc_bdev_nvme_get_controllers}

Get information about NVMe controllers.

#### Parameters

The user may specify no parameters in order to list all NVMe controllers, or one NVMe controller may be
specified by name.

{{ bdev_nvme_get_controllers_params }}

#### Response

The response is an array of objects containing information about the requested NVMe controllers.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_nvme_get_controllers",
  "params": {
    "name": "Nvme0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "Nvme0",
      "trid": {
        "trtype": "PCIe",
        "traddr": "0000:05:00.0"
      },
      "cntlid": 0
    }
  ]
}
~~~

### bdev_nvme_detach_controller {#rpc_bdev_nvme_detach_controller}

Detach NVMe controller and delete any associated bdevs. Optionally,
If all of the transport ID options are specified, only remove that
transport path from the specified controller. If that is the only
available path for the controller, this will also result in the
controller being detached and the associated bdevs being deleted.

returns true if the controller and bdevs were successfully destroyed
or the address was properly removed, false otherwise.

#### Parameters

{{ bdev_nvme_detach_controller_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Nvme0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_nvme_detach_controller",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_reset_controller {#rpc_bdev_nvme_reset_controller}

For non NVMe multipath, reset an NVMe controller whose name is given by the `name` parameter.

For NVMe multipath, an NVMe bdev controller is created and it aggregates multiple NVMe controllers.
The `name` parameter is an NVMe bdev controller name and the `cntlid` parameter is used to identify
an NVMe controller in the NVMe bdev controller. Reset only one NVMe-oF controller if the `cntlid`
parameter is specified, or all NVMe-oF controllers in an NVMe bdev controller if it is omitted.

Returns true if the controller reset was successful, false otherwise.

#### Parameters

{{ bdev_nvme_reset_controller_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_nvme_reset_controller",
  "params": {
    "name": "Nvme0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_enable_controller {#rpc_bdev_nvme_enable_controller}

For non NVMe multipath, enable an NVMe controller whose name is given by the `name` parameter.

For NVMe multipath, an NVMe bdev controller is created and it aggregates multiple NVMe controllers.
The `name` parameter is an NVMe bdev controller name and the `cntlid` parameter is used to identify
an NVMe controller in the NVMe bdev controller. Enable only one NVMe-oF controller if the `cntlid`
parameter is specified, or all NVMe-oF controllers in an NVMe bdev controller if it is omitted.

Returns true if the controller enablement was successful or a controller was already enabled, false otherwise.

#### Parameters

{{ bdev_nvme_enable_controller_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_nvme_enable_controller",
  "params": {
    "name": "Nvme0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_disable_controller {#rpc_bdev_nvme_disable_controller}

For non NVMe multipath, disable an NVMe controller whose name is given by the `name` parameter.

For NVMe multipath, an NVMe bdev controller is created and it aggregates multiple NVMe controllers.
The `name` parameter is an NVMe bdev controller name and the `cntlid` parameter is used to identify
an NVMe controller in the NVMe bdev controller. Disable only one NVMe-oF controller if the `cntlid`
parameter is specified, or all NVMe-oF controllers in an NVMe bdev controller if it is omitted.

Returns true if the controller disablement was successful or a controller was already disabled, false otherwise.

#### Parameters

{{ bdev_nvme_disable_controller_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_nvme_disable_controller",
  "params": {
    "name": "Nvme0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_start_discovery {#rpc_bdev_nvme_start_discovery}

Start a discovery service for the discovery subsystem of the specified transport ID.

The discovery service will read the discovery log page for the specified
discovery subsystem, and automatically attach to any subsystems found in the
log page. When determining a controller name to use when attaching, it will use
the 'name' parameter as a prefix, followed by a unique integer for that discovery
service. If the discovery service identifies a subsystem that has been previously
attached but is listed with a different path, it will use the same controller name
as the previous entry, and connect as a multipath.

When the discovery service sees that a subsystem entry has been removed
from the log page, it will automatically detach from that controller as well.

The 'name' is also used to later stop the discovery service.

#### Parameters

{{ bdev_nvme_start_discovery_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_start_discovery",
  "id": 1,
  "params": {
    "name": "nvme_auto",
    "trtype": "tcp",
    "traddr": "127.0.0.1",
    "hostnqn": "nqn.2021-12.io.spdk:host1",
    "adrfam": "ipv4",
    "trsvcid": "4420"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_stop_discovery {#rpc_bdev_nvme_stop_discovery}

Stop a discovery service. This includes detaching any controllers that were
discovered via the service that is being stopped.

#### Parameters

{{ bdev_nvme_stop_discovery_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_stop_discovery",
  "id": 1,
  "params": {
    "name": "nvme_auto"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_get_discovery_info {#rpc_bdev_nvme_get_discovery_info}

Get information about the discovery service.

#### Parameters

{{ bdev_nvme_get_discovery_info_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_get_discovery_info",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "nvme-disc",
      "trid": {
        "trtype": "TCP",
        "adrfam": "IPv4",
        "traddr": "127.0.0.1",
        "trsvcid": "8009",
        "subnqn": "nqn.2014-08.org.nvmexpress.discovery"
      },
      "referrals": []
    }
  ]
}
~~~

### bdev_nvme_get_io_paths {#rpc_bdev_nvme_get_io_paths}

Display all or the specified NVMe bdev's active I/O paths.

#### Parameters

{{ bdev_nvme_get_io_paths_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_get_io_paths",
  "id": 1,
  "params": {
    "name": "Nvme0n1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "poll_groups": [
      {
        "thread": "app_thread",
        "io_paths": [
          {
            "bdev_name": "Nvme0n1",
            "cntlid": 0,
            "current": true,
            "connected": true,
            "accessible": true,
            "transport": {
              "trtype": "RDMA",
              "traddr": "1.2.3.4",
              "trsvcid": "4420",
              "adrfam": "IPv4"
            }
          }
        ]
      }
    ]
  }
}
~~~

### bdev_nvme_set_preferred_path {#rpc_bdev_nvme_set_preferred_path}

Set the preferred I/O path for an NVMe bdev in multipath mode.

NOTE: This RPC does not support NVMe bdevs in failover mode.

#### Parameters

{{ bdev_nvme_set_preferred_path_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_set_preferred_path",
  "id": 1,
  "params": {
    "name": "Nvme0n1",
    "cntlid": 0
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_set_multipath_policy {#rpc_bdev_nvme_set_multipath_policy}

Set multipath policy of the NVMe bdev in multipath mode or set multipath
selector for active-active multipath policy.

#### Parameters

{{ bdev_nvme_set_multipath_policy_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_set_multipath_policy",
  "id": 1,
  "params": {
    "name": "Nvme0n1",
    "policy": "active_passive"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_get_path_iostat {#rpc_bdev_nvme_get_path_iostat}

Get I/O statistics for IO paths of the block device. Call RPC bdev_nvme_set_options to set enable_io_path_stat
true before using this RPC.

#### Parameters

{{ bdev_nvme_get_path_iostat_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_get_path_iostat",
  "id": 1,
  "params": {
    "name": "NVMe0n1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "name": "NVMe0n1",
    "stats": [
      {
        "trid": {
          "trtype": "TCP",
          "adrfam": "IPv4",
          "traddr": "10.169.204.201",
          "trsvcid": "4420",
          "subnqn": "nqn.2016-06.io.spdk:cnode1"
        },
        "stat": {
          "bytes_read": 676691968,
          "num_read_ops": 165201,
          "bytes_written": 0,
          "num_write_ops": 0,
          "bytes_unmapped": 0,
          "num_unmap_ops": 0,
          "max_read_latency_ticks": 521487,
          "min_read_latency_ticks": 0,
          "write_latency_ticks": 0,
          "max_write_latency_ticks": 0,
          "min_write_latency_ticks": 0,
          "unmap_latency_ticks": 0,
          "max_unmap_latency_ticks": 0,
          "min_unmap_latency_ticks": 0,
          "copy_latency_ticks": 0,
          "max_copy_latency_ticks": 0,
          "min_copy_latency_ticks": 0
        }
      },
      {
        "trid": {
          "trtype": "TCP",
          "adrfam": "IPv4",
          "traddr": "8.8.8.6",
          "trsvcid": "4420",
          "subnqn": "nqn.2016-06.io.spdk:cnode1"
        },
        "stat": {
          "bytes_read": 677138432,
          "num_read_ops": 165317,
          "bytes_written": 0,
          "num_write_ops": 0,
          "bytes_unmapped": 0,
          "num_unmap_ops": 0,
          "max_read_latency_ticks": 108525,
          "min_read_latency_ticks": 0,
          "write_latency_ticks": 0,
          "max_write_latency_ticks": 0,
          "min_write_latency_ticks": 0,
          "unmap_latency_ticks": 0,
          "max_unmap_latency_ticks": 0,
          "min_unmap_latency_ticks": 0,
          "copy_latency_ticks": 0,
          "max_copy_latency_ticks": 0,
          "min_copy_latency_ticks": 0
        }
      }
    ]
  }
}
~~~

### bdev_nvme_cuse_register {#rpc_bdev_nvme_cuse_register}

Register CUSE device on NVMe controller.

#### Parameters

{{ bdev_nvme_cuse_register_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_cuse_register",
  "id": 1,
  "params": {
    "name": "Nvme0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_cuse_unregister {#rpc_bdev_nvme_cuse_unregister}

Unregister CUSE device on NVMe controller.

#### Parameters

{{ bdev_nvme_cuse_unregister_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Nvme0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_nvme_cuse_unregister",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_set_keys {#rpc_bdev_nvme_set_keys}

Set DH-HMAC-CHAP keys and force (re)authentication on all connected qpairs across all multipath
controllers.  If none of the keys are provided, the keys will be cleared, meaning that any new
qpairs won't be authenticated.

If successful, existing qpairs won't be disconnected/reconnected.

#### Parameters

{{ bdev_nvme_set_keys_params }}

#### Example

Example request:

~~~json
{
  "method": "bdev_nvme_set_keys",
  "params": {
    "name": "nvme0",
    "dhchap_key": "key0",
    "dhchap_ctrlr_key": "key1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_zone_block_create {#rpc_bdev_zone_block_create}

Creates a virtual zone device on top of existing non-zoned bdev.

#### Parameters

{{ bdev_zone_block_create_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_zone_block_create",
  "id": 1,
  "params": {
    "name": "zone1",
    "base_bdev": "NVMe0n1",
    "zone_capacity": 4096,
    "optimal_open_zones": 32
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "zone1"
}
~~~

### bdev_zone_block_delete {#rpc_bdev_zone_block_delete}

Deletes a virtual zone device.

#### Parameters

{{ bdev_zone_block_delete_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_zone_block_delete",
  "id": 1,
  "params": {
    "name": "zone1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_apply_firmware {#rpc_bdev_nvme_apply_firmware}

Download and commit firmware to NVMe device.

#### Parameters

{{ bdev_nvme_apply_firmware_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_apply_firmware",
  "id": 1,
  "params": {
    "filename": "firmware_file",
    "bdev_name": "NVMe0n1"
  }
}
~~~

### bdev_nvme_get_transport_statistics {#rpc_bdev_nvme_get_transport_statistics}

Get bdev_nvme poll group transport statistics.

#### Parameters

{{ bdev_nvme_get_transport_statistics_params }}

#### Response

The response is an array of objects containing information about transport statistics per NVME poll group.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_nvme_get_transport_statistics"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "poll_groups": [
      {
        "thread": "nvmf_tgt_poll_group_000",
        "transports": [
          {
            "trname": "RDMA",
            "devices": [
              {
                "dev_name": "mlx5_1",
                "polls": 137492169,
                "idle_polls": 137492169,
                "completions": 0,
                "queued_requests": 0,
                "total_send_wrs": 0,
                "send_sq_doorbell_updates": 0,
                "total_recv_wrs": 0,
                "recv_sq_doorbell_updates": 0
              },
              {
                "dev_name": "mlx5_0",
                "polls": 137985185,
                "idle_polls": 137492169,
                "completions": 1474593,
                "queued_requests": 0,
                "total_send_wrs": 1474593,
                "send_sq_doorbell_updates": 426147,
                "total_recv_wrs": 1474721,
                "recv_sq_doorbell_updates": 348445
              }
            ]
          },
          {
            "trname": "PCIE",
            "polls": 435419831,
            "idle_polls": 434901004,
            "completions": 1485543,
            "cq_doorbell_updates": 518827,
            "queued_requests": 0,
            "submitted_requests": 1485543,
            "sq_doorbell_updates": 516081
          }
        ]
      },
      {
        "thread": "nvmf_tgt_poll_group_001",
        "transports": [
          {
            "trname": "RDMA",
            "devices": [
              {
                "dev_name": "mlx5_1",
                "polls": 140245630,
                "idle_polls": 140245630,
                "completions": 0,
                "queued_requests": 0,
                "total_send_wrs": 0,
                "send_sq_doorbell_updates": 0,
                "total_recv_wrs": 0,
                "recv_sq_doorbell_updates": 0
              },
              {
                "dev_name": "mlx5_0",
                "polls": 140751844,
                "idle_polls": 140245630,
                "completions": 1489298,
                "queued_requests": 0,
                "total_send_wrs": 1489298,
                "send_sq_doorbell_updates": 433510,
                "total_recv_wrs": 1489426,
                "recv_sq_doorbell_updates": 357956
              }
            ]
          },
          {
            "trname": "PCIE",
            "polls": 429044294,
            "idle_polls": 428525658,
            "completions": 1478730,
            "cq_doorbell_updates": 518636,
            "queued_requests": 0,
            "submitted_requests": 1478730,
            "sq_doorbell_updates": 511658
          }
        ]
      }
    ]
  }
}
~~~

### bdev_nvme_get_controller_health_info {#rpc_bdev_nvme_get_controller_health_info}

Display health log of the required NVMe bdev device.

#### Parameters

{{ bdev_nvme_get_controller_health_info_params }}

#### Response

The response is the object containing information about health log of the NVMe controller.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_get_controller_health_info",
  "id": 1,
  "params": {
    "name": "Nvme0"
  }
}
~~~

Example response:

~~~json
{
  "model_number": "INTEL SSDPE2KX020T8",
  "serial_number": "BTLJ72430ARH2P0BGN",
  "firmware_revision": "VDV10110",
  "traddr": "0000:08:00.0",
  "temperature_celsius": 32,
  "available_spare_percentage": 99,
  "available_spare_threshold_percentage": 10,
  "percentage_used": 2,
  "data_units_read": 1013408619,
  "data_units_written": 346792685,
  "host_read_commands": 30457773282,
  "host_write_commands": 18949677715,
  "controller_busy_time": 4979,
  "power_cycles": 49,
  "power_on_hours": 31118,
  "unsafe_shutdowns": 18,
  "media_errors": 17,
  "num_err_log_entries": 19,
  "warning_temperature_time_minutes": 0,
  "critical_composite_temperature_time_minutes": 0
}
~~~

### bdev_rbd_register_cluster {#rpc_bdev_rbd_register_cluster}

This method is available only if SPDK was build with Ceph RBD support.

#### Parameters

This RPC registers a Rados Cluster object handle which is only known
to rbd module, it uses user_id + config_param or user_id + config_file +
key_file or user_id + config_param + config_file + key_file to identify
a Rados cluster object.

When accessing the Ceph cluster as some user other than "admin" (the
default), the "user_id" has to be set.

The configuration items and secret key can be specified by setting config_param,
config_file and key_file, all of them, or none of them. If only config_param is
passed, all key/value pairs are passed to rados_conf_set to configure cluster access.
In practice, "mon_host" (= list of monitor address+port) and "key" (= the secret key
stored in Ceph keyrings) are enough. If config_file and key_file are specified, they must
exist with all relevant settings for accessing the Ceph cluster. If config_param, config_file
and key_file are specified, get the key/value pairs from config_file first and set to
rados_conf_set function, then set pairs in config_param and keyring in key_file. If nothing
is specified, it will get configuration file and key file from the default location
/etc/ceph/ceph.conf and /etc/ceph/ceph.client.user_id.keyring.

{{ bdev_rbd_register_cluster_params }}

#### Response

Name of newly created Rados cluster object.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "rbd_cluster",
    "user_id": "cinder",
    "config_file": "/root/ceph_conf/ceph.conf",
    "key_file": "/root/ceph_conf/ceph.client.cinder.keyring"
  },
  "jsonrpc": "2.0",
  "method": "bdev_rbd_register_cluster",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "rbd_cluster"
}
~~~

### bdev_rbd_unregister_cluster {#rpc_bdev_rbd_unregister_cluster}

This method is available only if SPDK was build with Ceph RBD support.
If there is still rbd bdev using this cluster, the unregisteration operation
will fail.

#### Parameters

{{ bdev_rbd_unregister_cluster_params }}

#### Response

`true` if Rados cluster object with provided name was deleted or `false` otherwise.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "rbd_cluster"
  },
  "jsonrpc": "2.0",
  "method": "bdev_rbd_unregister_cluster",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_rbd_get_clusters_info {#rpc_bdev_rbd_get_clusters_info}

This method is available only if SPDK was build with Ceph RBD support.

#### Parameters

{{ bdev_rbd_get_clusters_info_params }}

#### Response

Returns the cluster info of the Rados Cluster name if provided. Otherwise, it
returns the cluster info of every registered Raods Cluster name.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "rbd_cluster"
  },
  "jsonrpc": "2.0",
  "method": "bdev_rbd_get_clusters_info",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "cluster_name": "rbd_cluster"
}
~~~

### bdev_rbd_create {#rpc_bdev_rbd_create}

Create @ref bdev_config_rbd bdev

This method is available only if SPDK was build with Ceph RBD support.

#### Parameters

If no config is specified, Ceph configuration files must exist with
all relevant settings for accessing the pool. If a config map is
passed, the configuration files are ignored and instead all key/value
pairs are passed to rados_conf_set to configure cluster access. In
practice, "mon_host" (= list of monitor address+port) and "key" (= the
secret key stored in Ceph keyrings) are enough.

When accessing the image as some user other than "admin" (the
default), the "user_id" has to be set.

If provided with cluster_name option, it will use the Rados cluster object
referenced by the name (created by bdev_rbd_register_cluster RPC) and ignores
"user_id + config" combination to create its own Rados cluster. In this scenario,
all the bdevs will share the same cluster with one connection of Ceph in librbd module.
Performance tuning on the I/O workload could be done by estimating how many io_contxt
threads and messager threads in Ceph side and how many cores would be reasonable to provide
for SPDK to get up to your projections.

{{ bdev_rbd_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request with `key` from `/etc/ceph/ceph.client.admin.keyring`:

~~~json
{
  "params": {
    "pool_name": "rbd",
    "rbd_name": "foo",
    "config": {
      "mon_host": "192.168.7.1:6789,192.168.7.2:6789",
      "key": "AQDwf8db7zR1GRAA5k7NKXjS5S5V4mntwUDnGQ=="
    },
    "block_size": 4096,
    "uuid": "76210ea4-7920-40a0-a07b-8992a7443c76"
  },
  "jsonrpc": "2.0",
  "method": "bdev_rbd_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Ceph0"
}
~~~

Example request with `cluster_name`:

~~~json
{
  "params": {
    "pool_name": "rbd",
    "rbd_name": "foo",
    "block_size": 4096,
    "cluster_name": "rbd_cluster"
  },
  "jsonrpc": "2.0",
  "method": "bdev_rbd_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Ceph0"
}
~~~

### bdev_rbd_delete {#rpc_bdev_rbd_delete}

Delete @ref bdev_config_rbd bdev

This method is available only if SPDK was build with Ceph RBD support.

#### Parameters

{{ bdev_rbd_delete_params }}

#### Response

`true` if bdev with provided name was deleted or `false` otherwise.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Rbd0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_rbd_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_rbd_resize {#rpc_bdev_rbd_resize}

Resize @ref bdev_config_rbd bdev

This method is available only if SPDK was build with Ceph RBD support.

#### Parameters

{{ bdev_rbd_resize_params }}

#### Response

`true` if bdev with provided name was resized or `false` otherwise.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Rbd0",
    "new_size": "4096"
  },
  "jsonrpc": "2.0",
  "method": "bdev_rbd_resize",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_delay_create {#rpc_bdev_delay_create}

Create delay bdev. This bdev type redirects all IO to it's base bdev and inserts a delay on the completion
path to create an artificial drive latency. All latency values supplied to this bdev should be in microseconds.

#### Parameters

{{ bdev_delay_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "base_bdev_name": "Null0",
    "name": "Delay0",
    "avg_read_latency": "15",
    "p99_read_latency": "50",
    "avg_write_latency": "40",
    "p99_write_latency": "110"
  },
  "jsonrpc": "2.0",
  "method": "bdev_delay_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Delay0"
}
~~~

### bdev_delay_delete {#rpc_bdev_delay_delete}

Delete delay bdev.

#### Parameters

{{ bdev_delay_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Delay0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_delay_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_delay_update_latency {#rpc_bdev_delay_update_latency}

Update a target latency value associated with a given delay bdev. Any currently
outstanding I/O will be completed with the old latency.

#### Parameters

{{ bdev_delay_update_latency_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "delay_bdev_name": "Delay0",
    "latency_type": "avg_read",
    "latency_us": "100"
  },
  "jsonrpc": "2.0",
  "method": "bdev_delay_update_latency",
  "id": 1
}
~~~

Example response:

~~~json
{
  "result": "true"
}
~~~

### bdev_error_create {#rpc_bdev_error_create}

Construct error bdev.

#### Parameters

{{ bdev_error_create_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "base_name": "Malloc0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_error_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_error_delete {#rpc_bdev_error_delete}

Delete error bdev

#### Parameters

{{ bdev_error_delete_params }}

#### Response

`true` if bdev with provided name was deleted or `false` otherwise.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "EE_Malloc0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_error_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_error_inject_error {#rpc_bdev_error_inject_error}

Inject an error via an error bdev. Create an error bdev on base bdev first. Default 'num'
value is 1 and if 'num' is set to zero, the specified injection is disabled.

#### Parameters

{{ bdev_error_inject_error_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_error_inject_error",
  "id": 1,
  "params": {
    "name": "EE_Malloc0",
    "io_type": "write",
    "error_type": "pending",
    "num": 1
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_iscsi_set_options {#rpc_bdev_iscsi_set_options}

This RPC can be called at any time, but the new value will only take effect for new iSCSI bdevs.

#### Parameters

{{ bdev_iscsi_set_options_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "timeout_sec": 30
  },
  "jsonrpc": "2.0",
  "method": "bdev_iscsi_set_options",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_iscsi_create {#rpc_bdev_iscsi_create}

Connect to iSCSI target and create bdev backed by this connection.

This method is available only if SPDK was build with iSCSI initiator support.

#### Parameters

{{ bdev_iscsi_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "url": "iscsi://127.0.0.1/iqn.2016-06.io.spdk:disk1/0",
    "initiator_iqn": "iqn.2016-06.io.spdk:init",
    "name": "iSCSI0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_iscsi_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "iSCSI0"
}
~~~

### bdev_iscsi_delete {#rpc_bdev_iscsi_delete}

Delete iSCSI bdev and terminate connection to target.

This method is available only if SPDK was built with iSCSI initiator support.

#### Parameters

{{ bdev_iscsi_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "iSCSI0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_iscsi_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ftl_create {#rpc_bdev_ftl_create}

Create FTL bdev.

This RPC is subject to change.

#### Parameters

{{ bdev_ftl_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ftl0",
    "base_bdev": "nvme0n1",
    "cache": "nvme1n1",
    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3",
    "core_mask": "[0]",
    "overprovisioning": 10
  },
  "jsonrpc": "2.0",
  "method": "bdev_ftl_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "name": "ftl0",
    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
  }
}
~~~

### bdev_ftl_load {#rpc_bdev_ftl_load}

Loads FTL bdev.

This RPC is subject to change.

#### Parameters

{{ bdev_ftl_load_params }}

#### Response

Name of loaded bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ftl0",
    "base_bdev": "nvme0n1",
    "cache": "nvme1n1",
    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3",
    "core_mask": "[0]",
    "overprovisioning": 10
  },
  "jsonrpc": "2.0",
  "method": "bdev_ftl_load",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "name": "ftl0",
    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
  }
}
~~~

### bdev_ftl_delete {#rpc_bdev_ftl_delete}

Delete FTL bdev.

This RPC is subject to change.

#### Parameters

{{ bdev_ftl_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ftl0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ftl_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ftl_unload {#rpc_bdev_ftl_unload}

Unloads FTL bdev.

This RPC is subject to change.

#### Parameters

{{ bdev_ftl_unload_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ftl0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ftl_unload",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ftl_unmap {#rpc_bdev_ftl_unmap}

Unmap range of LBAs.

This RPC is subject to change.

#### Parameters

{{ bdev_ftl_unmap_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ftl0",
    "lba": "0",
    "num_blocks": "1024"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ftl_unmap",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ftl_get_stats {#rpc_bdev_ftl_get_stats}

Get IO statistics for FTL bdev

This RPC is subject to change.

#### Parameters

{{ bdev_ftl_get_stats_params }}

#### Response

The response is an object containing IO statistics for an FTL instance, split into multiple subobjects:

- `user` - contains information about number of IOs, and errors for any incoming requests,
- `cmp` - information about IO for the compaction process,
- `gc` - information about IO for the garbage collection process,
- `md_base` - internal metadata requests to the base FTL device,
- `md_nv_cache` - internal metadata requests to the cache device,
- `l2p` - requests done on the L2P cache region.

Each subobject contains the following information:

- `ios` - describes the total number of IOs requested,
- `blocks` - the total number of requested blocks,
- `errors` - describes the number of detected errors for a given operation, with the following distinctions:
  - `media` - media errors,
  - `crc` - mismatch in calculated CRC versus saved checksum in the metadata,
  - `other` - any other errors.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ftl0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ftl_get_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "name": "ftl0",
    "user": {
      "read": {
        "ios": 0,
        "blocks": 0,
        "errors": {
          "media": 0,
          "crc": 0,
          "other": 0
        }
      },
      "write": {
        "ios": 318707,
        "blocks": 318707,
        "errors": {
          "media": 0,
          "other": 0
        }
      }
    },
    "cmp": {
      "read": {
        "ios": 0,
        "blocks": 0,
        "errors": {
          "media": 0,
          "crc": 0,
          "other": 0
        }
      },
      "write": {
        "ios": 0,
        "blocks": 0,
        "errors": {
          "media": 0,
          "other": 0
        }
      }
    },
    "gc": {
      "read": {
        "ios": 0,
        "blocks": 0,
        "errors": {
          "media": 0,
          "crc": 0,
          "other": 0
        }
      },
      "write": {
        "ios": 0,
        "blocks": 0,
        "errors": {
          "media": 0,
          "other": 0
        }
      }
    },
    "md_base": {
      "read": {
        "ios": 0,
        "blocks": 0,
        "errors": {
          "media": 0,
          "crc": 0,
          "other": 0
        }
      },
      "write": {
        "ios": 1,
        "blocks": 32,
        "errors": {
          "media": 0,
          "other": 0
        }
      }
    },
    "md_nv_cache": {
      "read": {
        "ios": 0,
        "blocks": 0,
        "errors": {
          "media": 0,
          "crc": 0,
          "other": 0
        }
      },
      "write": {
        "ios": 1064,
        "blocks": 1073896,
        "errors": {
          "media": 0,
          "other": 0
        }
      }
    },
    "l2p": {
      "read": {
        "ios": 240659,
        "blocks": 240659,
        "errors": {
          "media": 0,
          "crc": 0,
          "other": 0
        }
      },
      "write": {
        "ios": 235745,
        "blocks": 235745,
        "errors": {
          "media": 0,
          "other": 0
        }
      }
    }
  }
}
~~~

### bdev_ftl_get_properties {#rpc_bdev_ftl_get_properties}

Get FTL properties

#### Parameters

{{ bdev_ftl_get_properties_params }}

#### Response

The response contains FTL bdev properties. Some of them can be modified, other
reported as read only.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ftl0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ftl_get_properties",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "name": "ftl0",
    "properties": [
      {
        "name": "property1",
        "value": "Property Value 1",
        "unit": "MiB/s",
        "desc": "This is an example of read-only property",
        "read-only": true
      },
      {
        "name": "property2",
        "value": 17,
        "unit": "s",
        "desc": "This is an example of FTL modifiable property",
        "read-only": false
      }
    ]
  }
}
~~~

### bdev_ftl_set_property {#rpc_bdev_ftl_set_property}

Set FTL property. Trying to set a read-only property will result in an error.

#### Parameters

{{ bdev_ftl_set_property_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "ftl0",
    "property": "nv_cache.flush",
    "value": "true"
  },
  "jsonrpc": "2.0",
  "method": "bdev_ftl_set_property",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_passthru_create {#rpc_bdev_passthru_create}

Create passthru bdev. This bdev type redirects all IO to it's base bdev. It has no other purpose than being an example
and a starting point in development of new bdev type.

#### Parameters

{{ bdev_passthru_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "base_bdev_name": "Malloc0",
    "name": "Passsthru0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_passthru_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Passsthru0"
}
~~~

### bdev_passthru_delete {#rpc_bdev_passthru_delete}

Delete passthru bdev.

#### Parameters

{{ bdev_passthru_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "Passsthru0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_passthru_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_xnvme_create {#rpc_bdev_xnvme_create}

Create xnvme bdev. This bdev type redirects all IO to its underlying backend.

#### Parameters

{{ bdev_xnvme_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_xnvme_create",
  "id": 1,
  "params": {
    "name": "bdev_ng0n1",
    "filename": "/dev/ng0n1",
    "io_mechanism": "io_uring_cmd",
    "conserve_cpu": false
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "bdev_ng0n1"
}
~~~

### bdev_xnvme_delete {#rpc_bdev_xnvme_delete}

Delete xnvme bdev.

#### Parameters

{{ bdev_xnvme_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "bdev_ng0n1"
  },
  "jsonrpc": "2.0",
  "method": "bdev_xnvme_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_virtio_attach_controller {#rpc_bdev_virtio_attach_controller}

Create new initiator @ref bdev_config_virtio_scsi or @ref bdev_config_virtio_blk and expose all found bdevs.

#### Parameters

In case of Virtio SCSI the `name` parameter will be base name for new created bdevs. For Virtio Blk `name` will be the
name of created bdev.

`vq_count` and `vq_size` parameters are valid only if `trtype` is `user`.

{{ bdev_virtio_attach_controller_params }}

#### Response

Array of names of newly created bdevs.

#### Example

Example request:

~~~json
{
  "params": {
    "name": "VirtioScsi0",
    "trtype": "user",
    "vq_size": 128,
    "dev_type": "scsi",
    "traddr": "/tmp/VhostScsi0",
    "vq_count": 4
  },
  "jsonrpc": "2.0",
  "method": "bdev_virtio_attach_controller",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "VirtioScsi0t2",
    "VirtioScsi0t4"
  ]
}
~~~

### bdev_virtio_scsi_get_devices {#rpc_bdev_virtio_scsi_get_devices}

Show information about all available Virtio SCSI devices.

#### Parameters

{{ bdev_virtio_scsi_get_devices_params }}

#### Response

Array of Virtio SCSI information objects.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_virtio_scsi_get_devices",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "VirtioScsi0",
      "virtio": {
        "vq_size": 128,
        "vq_count": 4,
        "type": "user",
        "socket": "/tmp/VhostScsi0"
      }
    }
  ]
}
~~~

### bdev_virtio_detach_controller {#rpc_bdev_virtio_detach_controller}

Remove a Virtio device. This command can be used to remove any type of virtio device.

#### Parameters

{{ bdev_virtio_detach_controller_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "VirtioUser0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_virtio_detach_controller",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_virtio_blk_set_hotplug {#rpc_bdev_virtio_blk_set_hotplug}

Enable/Disable the virtio blk hotplug monitor or change the monitor period time

#### Parameters

When the enable is true then the period-us is optional. If user don't set the period time then use the default
value. When the enable is false then the period-us is not required.

{{ bdev_virtio_blk_set_hotplug_params }}

#### Response

True the rpc is successful otherwise false

#### Example

Example request:

~~~json
{
  "params": {
    "enable": "true",
    "period-us": "1000000"
  },
  "jsonrpc": "2.0",
  "method": "bdev_virtio_blk_set_hotplug",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## iSCSI Target {#jsonrpc_components_iscsi_tgt}

### iscsi_set_options {#rpc_iscsi_set_options}

Set global parameters for iSCSI targets.

This RPC may only be called before SPDK subsystems have been initialized. This RPC can be called only once.

#### Parameters

To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`.

Parameters `disable_chap` and `require_chap` are mutually exclusive. Parameters `no_discovery_auth`, `req_discovery_auth`,
`req_discovery_auth_mutual`, and `discovery_auth_group` are still available instead of `disable_chap`, `require_chap`,
`mutual_chap`, and `chap_group`, respectivey but will be removed in future releases.

{{ iscsi_set_options_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "allow_duplicated_isid": true,
    "default_time2retain": 60,
    "first_burst_length": 8192,
    "immediate_data": true,
    "node_base": "iqn.2016-06.io.spdk",
    "max_sessions": 128,
    "nop_timeout": 30,
    "nop_in_interval": 30,
    "auth_file": "/usr/local/etc/spdk/auth.conf",
    "disable_chap": true,
    "default_time2wait": 2
  },
  "jsonrpc": "2.0",
  "method": "iscsi_set_options",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_get_options {#rpc_iscsi_get_options}

Show global parameters of iSCSI targets.

#### Parameters

{{ iscsi_get_options_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iscsi_get_options",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "allow_duplicated_isid": true,
    "default_time2retain": 60,
    "first_burst_length": 8192,
    "immediate_data": true,
    "node_base": "iqn.2016-06.io.spdk",
    "mutual_chap": false,
    "nop_in_interval": 30,
    "chap_group": 0,
    "max_connections_per_session": 2,
    "max_queue_depth": 64,
    "nop_timeout": 30,
    "max_sessions": 128,
    "error_recovery_level": 0,
    "auth_file": "/usr/local/etc/spdk/auth.conf",
    "disable_chap": true,
    "default_time2wait": 2,
    "require_chap": false,
    "max_large_datain_per_connection": 64,
    "max_r2t_per_connection": 4
  }
}
~~~

### scsi_get_devices {#rpc_scsi_get_devices}

Display SCSI devices

#### Parameters

{{ scsi_get_devices_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "scsi_get_devices",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "id": 0,
      "device_name": "iqn.2016-06.io.spdk:Target3"
    }
  ]
}
~~~

### iscsi_set_discovery_auth {#rpc_iscsi_set_discovery_auth}

Set CHAP authentication for sessions dynamically.

#### Parameters

Parameters `disable_chap` and `require_chap` are mutually exclusive.

{{ iscsi_set_discovery_auth_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "chap_group": 1,
    "require_chap": true,
    "mutual_chap": true
  },
  "jsonrpc": "2.0",
  "method": "iscsi_set_discovery_auth",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_create_auth_group {#rpc_iscsi_create_auth_group}

Create an authentication group for CHAP authentication.

#### Parameters

{{ iscsi_create_auth_group_params }}

##### secret {#rpc_iscsi_create_auth_group_secret}

{{ iscsi_auth_secret_object }}

#### Example

Example request:

~~~json
{
  "params": {
    "secrets": [
      {
        "muser": "mu1",
        "secret": "s1",
        "user": "u1",
        "msecret": "ms1"
      }
    ],
    "tag": 2
  },
  "jsonrpc": "2.0",
  "method": "iscsi_create_auth_group",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_delete_auth_group {#rpc_iscsi_delete_auth_group}

Delete an existing authentication group for CHAP authentication.

#### Parameters

{{ iscsi_delete_auth_group_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "tag": 2
  },
  "jsonrpc": "2.0",
  "method": "iscsi_delete_auth_group",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_get_auth_groups {#rpc_iscsi_get_auth_groups}

Show information about all existing authentication group for CHAP authentication.

#### Parameters

{{ iscsi_get_auth_groups_params }}

#### Response

Array of objects describing authentication group.

 Name    | Type   | Description
-------- | ------ | ---------------------------------------------------------
 tag     | number | Authentication group tag
 secrets | array  | Array of @ref rpc_iscsi_create_auth_group_secret objects

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iscsi_get_auth_groups",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "secrets": [
        {
          "muser": "mu1",
          "secret": "s1",
          "user": "u1",
          "msecret": "ms1"
        }
      ],
      "tag": 1
    },
    {
      "secrets": [
        {
          "secret": "s2",
          "user": "u2"
        }
      ],
      "tag": 2
    }
  ]
}
~~~

### iscsi_auth_group_add_secret {#rpc_iscsi_auth_group_add_secret}

Add a secret to an existing authentication group for CHAP authentication.

#### Parameters

{{ iscsi_auth_group_add_secret_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "muser": "mu3",
    "secret": "s3",
    "tag": 2,
    "user": "u3",
    "msecret": "ms3"
  },
  "jsonrpc": "2.0",
  "method": "iscsi_auth_group_add_secret",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_auth_group_remove_secret {#rpc_iscsi_auth_group_remove_secret}

Remove a secret from an existing authentication group for CHAP authentication.

#### Parameters

{{ iscsi_auth_group_remove_secret_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "tag": 2,
    "user": "u3"
  },
  "jsonrpc": "2.0",
  "method": "iscsi_auth_group_remove_secret",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_get_initiator_groups {#rpc_iscsi_get_initiator_groups}

Show information about all available initiator groups.

#### Parameters

{{ iscsi_get_initiator_groups_params }}

#### Response

Array of objects describing initiator groups.

 Name       | Type   | Description
----------- | ------ | ---------------------------------------------
 tag        | number | Initiator group tag
 initiators | array  | Array of initiator hostnames or IP addresses
 netmasks   | array  | Array of initiator netmasks

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iscsi_get_initiator_groups",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "initiators": [
        "iqn.2016-06.io.spdk:host1",
        "iqn.2016-06.io.spdk:host2"
      ],
      "tag": 1,
      "netmasks": [
        "192.168.1.0/24"
      ]
    }
  ]
}
~~~

### iscsi_create_initiator_group {#rpc_iscsi_create_initiator_group}

Add an initiator group.

#### Parameters

{{ iscsi_create_initiator_group_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "initiators": [
      "iqn.2016-06.io.spdk:host1",
      "iqn.2016-06.io.spdk:host2"
    ],
    "tag": 1,
    "netmasks": [
      "192.168.1.0/24"
    ]
  },
  "jsonrpc": "2.0",
  "method": "iscsi_create_initiator_group",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_delete_initiator_group {#rpc_iscsi_delete_initiator_group}

Delete an existing initiator group.

#### Parameters

{{ iscsi_delete_initiator_group_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "tag": 1
  },
  "jsonrpc": "2.0",
  "method": "iscsi_delete_initiator_group",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_initiator_group_add_initiators {#rpc_iscsi_initiator_group_add_initiators}

Add initiators to an existing initiator group.

#### Parameters

{{ iscsi_initiator_group_add_initiators_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "initiators": [
      "iqn.2016-06.io.spdk:host3"
    ],
    "tag": 1,
    "netmasks": [
      "255.255.255.1"
    ]
  },
  "jsonrpc": "2.0",
  "method": "iscsi_initiator_group_add_initiators",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_initiator_group_remove_initiators {#rpc_iscsi_initiator_group_remove_initiators}

Remove initiators from an initiator group.

#### Parameters

{{ iscsi_initiator_group_remove_initiators_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "initiators": [
      "iqn.2016-06.io.spdk:host3"
    ],
    "tag": 1,
    "netmasks": [
      "255.255.255.1"
    ]
  },
  "jsonrpc": "2.0",
  "method": "iscsi_initiator_group_remove_initiators",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_get_target_nodes {#rpc_iscsi_get_target_nodes}

Show information about all available iSCSI target nodes.

#### Parameters

{{ iscsi_get_target_nodes_params }}

#### Response

Array of objects describing target node.

 Name          | Type    | Description
-------------- | ------- | ---------------------------------------------------------------------------------
 name          | string  | Target node name (ASCII)
 alias_name    | string  | Target node alias name (ASCII)
 pg_ig_maps    | array   | Array of Portal_Group_Tag:Initiator_Group_Tag mappings
 luns          | array   | Array of Bdev names to LUN ID mappings
 queue_depth   | number  | Target queue depth
 disable_chap  | boolean | CHAP authentication should be disabled for this target
 require_chap  | boolean | CHAP authentication should be required for this target
 mutual_chap   | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
 chap_group    | number  | Authentication group ID for this target node
 header_digest | boolean | Header Digest should be required for this target node
 data_digest   | boolean | Data Digest should be required for this target node

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iscsi_get_target_nodes",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "luns": [
        {
          "lun_id": 0,
          "bdev_name": "Nvme0n1"
        }
      ],
      "mutual_chap": false,
      "name": "iqn.2016-06.io.spdk:target1",
      "alias_name": "iscsi-target1-alias",
      "require_chap": false,
      "chap_group": 0,
      "pg_ig_maps": [
        {
          "ig_tag": 1,
          "pg_tag": 1
        }
      ],
      "data_digest": false,
      "disable_chap": false,
      "header_digest": false,
      "queue_depth": 64
    }
  ]
}
~~~

### iscsi_create_target_node {#rpc_iscsi_create_target_node}

Add an iSCSI target node.

#### Parameters

Parameters `disable_chap` and `require_chap` are mutually exclusive.

{{ iscsi_create_target_node_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "luns": [
      {
        "lun_id": 0,
        "bdev_name": "Nvme0n1"
      }
    ],
    "mutual_chap": true,
    "name": "target2",
    "alias_name": "iscsi-target2-alias",
    "pg_ig_maps": [
      {
        "ig_tag": 1,
        "pg_tag": 1
      },
      {
        "ig_tag": 2,
        "pg_tag": 2
      }
    ],
    "data_digest": true,
    "disable_chap": true,
    "header_digest": true,
    "queue_depth": 24
  },
  "jsonrpc": "2.0",
  "method": "iscsi_create_target_node",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_target_node_set_auth {#rpc_iscsi_target_node_set_auth}

Set CHAP authentication to an existing iSCSI target node.

#### Parameters

Parameters `disable_chap` and `require_chap` are mutually exclusive.

{{ iscsi_target_node_set_auth_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "chap_group": 1,
    "require_chap": true,
    "name": "iqn.2016-06.io.spdk:target1",
    "mutual_chap": true
  },
  "jsonrpc": "2.0",
  "method": "iscsi_target_node_set_auth",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_target_node_add_pg_ig_maps {#rpc_iscsi_target_node_add_pg_ig_maps}

Add initiator group to portal group mappings to an existing iSCSI target node.

#### Parameters

{{ iscsi_target_node_add_pg_ig_maps_params }}

##### Portal to Initiator group mappings object

{{ iscsi_tgt_pg_ig_map_object }}

#### Example

Example request:

~~~json
{
  "params": {
    "pg_ig_maps": [
      {
        "ig_tag": 1,
        "pg_tag": 1
      },
      {
        "ig_tag": 2,
        "pg_tag": 2
      },
      {
        "ig_tag": 3,
        "pg_tag": 3
      }
    ],
    "name": "iqn.2016-06.io.spdk:target3"
  },
  "jsonrpc": "2.0",
  "method": "iscsi_target_node_add_pg_ig_maps",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_target_node_remove_pg_ig_maps {#rpc_iscsi_target_node_remove_pg_ig_maps}

Delete initiator group to portal group mappings from an existing iSCSI target node.

#### Parameters

{{ iscsi_target_node_remove_pg_ig_maps_params }}

##### Portal to Initiator group mappings object

{{ iscsi_tgt_pg_ig_map_object }}

#### Example

Example request:

~~~json
{
  "params": {
    "pg_ig_maps": [
      {
        "ig_tag": 1,
        "pg_tag": 1
      },
      {
        "ig_tag": 2,
        "pg_tag": 2
      },
      {
        "ig_tag": 3,
        "pg_tag": 3
      }
    ],
    "name": "iqn.2016-06.io.spdk:target3"
  },
  "jsonrpc": "2.0",
  "method": "iscsi_target_node_remove_pg_ig_maps",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_delete_target_node {#rpc_iscsi_delete_target_node}

Delete an iSCSI target node.

#### Parameters

{{ iscsi_delete_target_node_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "iqn.2016-06.io.spdk:target1"
  },
  "jsonrpc": "2.0",
  "method": "iscsi_delete_target_node",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_get_portal_groups {#rpc_iscsi_get_portal_groups}

Show information about all available portal groups.

#### Parameters

{{ iscsi_get_portal_groups_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iscsi_get_portal_groups",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "portals": [
        {
          "host": "127.0.0.1",
          "port": "3260"
        }
      ],
      "tag": 1,
      "private": false
    }
  ]
}
~~~

### iscsi_create_portal_group {#rpc_iscsi_create_portal_group}

Add a portal group.

#### Parameters

{{ iscsi_create_portal_group_params }}

##### Portal object

{{ iscsi_portal_object }}

#### Example

Example request:

~~~json
{
  "params": {
    "portals": [
      {
        "host": "127.0.0.1",
        "port": "3260"
      }
    ],
    "tag": 1
  },
  "jsonrpc": "2.0",
  "method": "iscsi_create_portal_group",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_start_portal_group {#rpc_iscsi_start_portal_group}

Start listening on portals if the portal group is not started yet, or do nothing
if the portal group already started. Return a success response for both cases.

#### Parameters

{{ iscsi_start_portal_group_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "tag": 1
  },
  "jsonrpc": "2.0",
  "method": "iscsi_start_portal_group",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_delete_portal_group {#rpc_iscsi_delete_portal_group}

Delete an existing portal group.

#### Parameters

{{ iscsi_delete_portal_group_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "tag": 1
  },
  "jsonrpc": "2.0",
  "method": "iscsi_delete_portal_group",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_portal_group_set_auth {#rpc_iscsi_portal_group_set_auth}

Set CHAP authentication for discovery sessions specific for the existing iSCSI portal group.
This RPC overwrites the setting by the global parameters for the iSCSI portal group.

#### Parameters

Parameters `disable_chap` and `require_chap` are mutually exclusive.

{{ iscsi_portal_group_set_auth_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "tag": 1,
    "chap_group": 1,
    "require_chap": true,
    "mutual_chap": true
  },
  "jsonrpc": "2.0",
  "method": "iscsi_portal_group_set_auth",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_get_connections {#rpc_iscsi_get_connections}

Show information about all active connections.

#### Parameters

{{ iscsi_get_connections_params }}

#### Response

Array of objects describing iSCSI connection.

 Name             | Type   | Description
----------------- | ------ | -----------------------------------------------
 id               | number | Index (used for TTT - Target Transfer Tag)
 cid              | number | CID (Connection ID)
 tsih             | number | TSIH (Target Session Identifying Handle)
 lcore_id         | number | Core number on which the iSCSI connection runs
 initiator_addr   | string | Initiator address
 target_addr      | string | Target address
 target_node_name | string | Target node name (ASCII) without prefix

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iscsi_get_connections",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "tsih": 4,
      "cid": 0,
      "target_node_name": "target1",
      "lcore_id": 0,
      "initiator_addr": "10.0.0.2",
      "target_addr": "10.0.0.1",
      "id": 0
    }
  ]
}
~~~

### iscsi_get_stats {#rpc_iscsi_get_stats}

Show stat information of iSCSI connections.

#### Parameters

{{ iscsi_get_stats_params }}

#### Response

Stat information of iSCSI connections.

 Name    | Type   | Description
-------- | ------ | ----------------------------------
 invalid | number | The number of invalid connections
 running | number | The number of running connections
 exiting | number | The number of exiting connections
 exited  | number | The number of exited connections

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iscsi_get_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "invalid": 0,
    "running": 5,
    "exiting": 0,
    "exited": 0
  }
}
~~~

### iscsi_target_node_add_lun {#rpc_iscsi_target_node_add_lun}

Add an LUN to an existing iSCSI target node.

#### Parameters

{{ iscsi_target_node_add_lun_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "lun_id": 2,
    "name": "iqn.2016-06.io.spdk:target1",
    "bdev_name": "Malloc0"
  },
  "jsonrpc": "2.0",
  "method": "iscsi_target_node_add_lun",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_target_node_set_redirect {#rpc_iscsi_target_node_set_redirect}

Update redirect portal of the primary portal group for the target node,

#### Parameters

If both redirect_host and redirect_port are omitted, clear the redirect portal.

{{ iscsi_target_node_set_redirect_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "iqn.2016-06.io.spdk:target1",
    "pg_tag": 1,
    "redirect_host": "10.0.0.3",
    "redirect_port": "3260"
  },
  "jsonrpc": "2.0",
  "method": "iscsi_target_node_set_redirect",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_target_node_request_logout {#rpc_iscsi_target_node_request_logout}

For the target node, request connections whose portal group tag match to logout,
or request all connections to logout if portal group tag is omitted.

#### Parameters

{{ iscsi_target_node_request_logout_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "iqn.2016-06.io.spdk:target1",
    "pg_tag": 1
  },
  "jsonrpc": "2.0",
  "method": "iscsi_target_node_request_logout",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_enable_histogram {#rpc_iscsi_enable_histogram}

Control whether collecting data for histogram is enabled for specified iscsi target node.

#### Parameters

{{ iscsi_enable_histogram_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "iscsi_enable_histogram",
  "params": {
    "name": "iqn.2016-06.io.spdk:target1",
    "enable": true
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iscsi_get_histogram {#rpc_iscsi_get_histogram}

Get latency histogram for specified iscsi target node.

#### Parameters

{{ iscsi_get_histogram_params }}

#### Response

 Name        | Type   | Description
------------ | ------ | -------------------------------------
 histogram   |        | Base64 encoded histogram
 granularity |        | Granularity of the histogram buckets
 tsc_rate    |        | Ticks per second

#### Example

Note that histogram field is trimmed, actual encoded histogram length is ~80kb.

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "iscsi_get_histogram",
  "params": {
    "name": "iqn.2016-06.io.spdk:target1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "histogram": "AAAAAAAAAAAAAA...AAAAAAAAA==",
    "tsc_rate": 2300000000,
    "granularity": 7
  }
}
~~~

## NVMe-oF Target {#jsonrpc_components_nvmf_tgt}

### nvmf_create_transport {#rpc_nvmf_create_transport}

Initialize an NVMe-oF transport with the given options.

#### Parameters

{{ nvmf_create_transport_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "nvmf_create_transport",
  "id": 1,
  "params": {
    "trtype": "RDMA",
    "max_queue_depth": 32
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_get_subsystems {#rpc_nvmf_get_subsystems}

#### Parameters

{{ nvmf_get_subsystems_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_get_subsystems"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "nqn": "nqn.2014-08.org.nvmexpress.discovery",
      "subtype": "Discovery",
      "listen_addresses": [],
      "hosts": [],
      "allow_any_host": true
    },
    {
      "nqn": "nqn.2016-06.io.spdk:cnode1",
      "subtype": "NVMe",
      "listen_addresses": [
        {
          "trtype": "RDMA",
          "adrfam": "IPv4",
          "traddr": "192.168.0.123",
          "trsvcid": "4420"
        }
      ],
      "hosts": [
        {
          "nqn": "nqn.2016-06.io.spdk:host1"
        }
      ],
      "allow_any_host": false,
      "serial_number": "abcdef",
      "model_number": "ghijklmnop",
      "passthrough": false,
      "namespaces": [
        {
          "nsid": 1,
          "name": "Malloc2"
        },
        {
          "nsid": 2,
          "name": "Nvme0n1"
        }
      ]
    }
  ]
}
~~~

### nvmf_create_subsystem {#rpc_nvmf_create_subsystem}

Construct an NVMe over Fabrics target subsystem.

#### Parameters

{{ nvmf_create_subsystem_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_create_subsystem",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "allow_any_host": false,
    "serial_number": "abcdef",
    "model_number": "ghijklmnop"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_delete_subsystem {#rpc_nvmf_delete_subsystem}

Delete an existing NVMe-oF subsystem.

#### Parameters

{{ nvmf_delete_subsystem_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_delete_subsystem",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_add_listener {#rpc_nvmf_subsystem_add_listener}

Add a new listen address to an NVMe-oF subsystem.

This method will fail if listener with given address already exists.

#### Parameters

{{ nvmf_subsystem_add_listener_params }}

##### listen_address {#rpc_nvmf_listen_address}

The listen_address is used for adding the listeners to the NVMe-oF target
and for referring to discovery services on other targets.

{{ nvmf_listen_address_object }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_add_listener",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "listen_address": {
      "trtype": "RDMA",
      "adrfam": "IPv4",
      "traddr": "192.168.0.123",
      "trsvcid": "4420"
    }
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_remove_listener {#rpc_nvmf_subsystem_remove_listener}

Remove a listen address from an NVMe-oF subsystem.

#### Parameters

{{ nvmf_subsystem_remove_listener_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_remove_listener",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "listen_address": {
      "trtype": "RDMA",
      "adrfam": "IPv4",
      "traddr": "192.168.0.123",
      "trsvcid": "4420"
    }
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_listener_set_ana_state {#rpc_nvmf_subsystem_listener_set_ana_state}

Set ANA state of a listener for an NVMe-oF subsystem. Only the ANA state of the specified ANA
group is updated, or ANA states of all ANA groups if ANA group is not specified.

#### Parameters

{{ nvmf_subsystem_listener_set_ana_state_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_listener_set_ana_state",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "listen_address": {
      "trtype": "RDMA",
      "adrfam": "IPv4",
      "traddr": "192.168.0.123",
      "trsvcid": "4420"
    },
    "ana_state": "inaccessible"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_add_ns {#rpc_nvmf_subsystem_add_ns}

Add a namespace to a subsystem. The namespace ID is returned as the result.

#### Parameters

{{ nvmf_subsystem_add_ns_params }}

##### namespace {#rpc_nvmf_namespace}

{{ nvmf_namespace_object }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_add_ns",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "namespace": {
      "nsid": 3,
      "bdev_name": "Nvme0n1",
      "ptpl_file": "/opt/Nvme0n1PR.json"
    }
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 3
}
~~~

### nvmf_subsystem_remove_ns {#rpc_nvmf_subsystem_remove_ns}

Remove a namespace from a subsystem.

#### Parameters

{{ nvmf_subsystem_remove_ns_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_remove_ns",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "nsid": 1
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_set_ns_ana_group {#rpc_nvmf_subsystem_set_ns_ana_group}

Change ANA group ID of a namespace in a subsystem.

#### Parameters

{{ nvmf_subsystem_set_ns_ana_group_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_set_ns_ana_group",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "nsid": 1,
    "anagrpid": 2
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_add_host {#rpc_nvmf_subsystem_add_host}

Add a host NQN to the list of allowed hosts.  Adding an already allowed host will result in an
error.

#### Parameters

{{ nvmf_subsystem_add_host_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_add_host",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "host": "nqn.2016-06.io.spdk:host1",
    "dhchap_key": "key0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_remove_host {#rpc_nvmf_subsystem_remove_host}

Remove a host NQN from the list of allowed hosts.

#### Parameters

{{ nvmf_subsystem_remove_host_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_remove_host",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "host": "nqn.2016-06.io.spdk:host1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_allow_any_host {#rpc_nvmf_subsystem_allow_any_host}

Configure a subsystem to allow any host to connect or to enforce the host NQN list.

#### Parameters

{{ nvmf_subsystem_allow_any_host_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_allow_any_host",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "allow_any_host": true
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_set_keys {#rpc_nvmf_subsystem_set_keys}

Set keys required for a host to connect to a given subsystem.  This will overwrite the keys set by
`nvmf_subsystem_add_host`.  If none of the keys are provided, host's keys will be cleared, allowing
it to connect without authentication.

#### Parameters

{{ nvmf_subsystem_set_keys_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_set_keys",
  "params": {
    "nqn": "nqn.2024-06.io.spdk:cnode1",
    "host": "nqn.2024-06.io.spdk:host1",
    "dhchap_key": "key0",
    "dchap_ctrlr_key": "key1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_subsystem_get_controllers {#rpc_nvmf_subsystem_get_controllers}

#### Parameters

{{ nvmf_subsystem_get_controllers_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_get_controllers",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "cntlid": 1,
      "cntrltype": "io",
      "hostnqn": "nqn.2016-06.io.spdk:host1",
      "hostid": "27dad528-6368-41c3-82d3-0b956b49025d",
      "num_io_qpairs": 5
    }
  ]
}
~~~

### nvmf_subsystem_get_qpairs {#rpc_nvmf_subsystem_get_qpairs}

#### Parameters

{{ nvmf_subsystem_get_qpairs_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_get_qpairs",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "cntlid": 1,
      "qid": 0,
      "state": "active",
      "listen_address": {
        "trtype": "RDMA",
        "adrfam": "IPv4",
        "traddr": "192.168.0.123",
        "trsvcid": "4420"
      }
    },
    {
      "cntlid": 1,
      "qid": 1,
      "state": "active",
      "listen_address": {
        "trtype": "RDMA",
        "adrfam": "IPv4",
        "traddr": "192.168.0.123",
        "trsvcid": "4420"
      }
    }
  ]
}
~~~

### nvmf_subsystem_get_listeners {#rpc_nvmf_subsystem_get_listeners}

#### Parameters

{{ nvmf_subsystem_get_listeners_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_subsystem_get_listeners",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": {
        "trtype": "RDMA",
        "adrfam": "IPv4",
        "traddr": "192.168.0.123",
        "trsvcid": "4420"
      },
      "ana_state": "optimized"
    }
  ]
}
~~~

### nvmf_ns_add_host {#rpc_nvmf_ns_add_host}

Make the specified namespace of the specified subnqn visible to any existing
or future controllers with the specified hostnqn.

Note: the namespace must have been added with no_auto_visible = false
(see @ref rpc_nvmf_subsystem_add_ns).

#### Parameters

{{ nvmf_ns_add_host_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_ns_add_host",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "nsid": 1,
    "host": "nqn.2024-01.io.spdk:host0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_ns_remove_host {#rpc_nvmf_ns_remove_host}

Make the specified namespace of the specified subnqn not visible to any existing
or future controllers with the specified hostnqn.

Note: the namespace must have been added to the subsystem with
no_auto_visible = false (see @ref rpc_nvmf_subsystem_add_ns).

#### Parameters

{{ nvmf_ns_remove_host_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_ns_remove_host",
  "params": {
    "nqn": "nqn.2016-06.io.spdk:cnode1",
    "nsid": 1,
    "host": "nqn.2024-01.io.spdk:host0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_set_max_subsystems {#rpc_nvmf_set_max_subsystems}

Set the maximum allowed subsystems for the NVMe-oF target.  This RPC may only be called
before SPDK subsystems have been initialized.

#### Parameters

{{ nvmf_set_max_subsystems_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_set_max_subsystems",
  "params": {
    "max_subsystems": 1024
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_discovery_add_referral {#rpc_nvmf_discovery_add_referral}

Add a discovery service referral to an NVMe-oF target. If a referral with the given
parameters already exists, no action will be taken.

#### Parameters

{{ nvmf_discovery_add_referral_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_discovery_add_referral",
  "params": {
    "address": {
      "trtype": "RDMA",
      "adrfam": "IPv4",
      "traddr": "192.168.0.123",
      "trsvcid": "4420"
    }
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_discovery_remove_referral {#rpc_nvmf_discovery_remove_referral}

Remove a discovery service referral from an NVMe-oF target.

#### Parameters

{{ nvmf_discovery_remove_referral_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_discovery_remove_referral",
  "params": {
    "address": {
      "trtype": "RDMA",
      "adrfam": "IPv4",
      "traddr": "192.168.0.123",
      "trsvcid": "4420"
    }
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_discovery_get_referrals {#rpc_nvmf_discovery_get_referrals}

#### Parameters

{{ nvmf_discovery_get_referrals_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_discovery_get_referrals"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": {
        "trtype": "RDMA",
        "adrfam": "IPv4",
        "traddr": "192.168.0.123",
        "trsvcid": "4420"
      }
    }
  ]
}
~~~

### nvmf_set_config {#rpc_nvmf_set_config}

Set global configuration of NVMe-oF target.  This RPC may only be called before SPDK subsystems
have been initialized.

#### Parameters

{{ nvmf_set_config_params }}

##### admin_cmd_passthru {#spdk_nvmf_admin_passthru_conf}

{{ nvmf_admin_cmd_passthru_object }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_set_config",
  "params": {
    "acceptor_poll_rate": 10000
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_get_transports {#rpc_nvmf_get_transports}

#### Parameters

The user may specify no parameters in order to list all transports, or a transport may be
specified by type.

{{ nvmf_get_transports_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "nvmf_get_transports"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "type": "RDMA",
      "max_queue_depth": 128,
      "max_io_qpairs_per_ctrlr": 64,
      "in_capsule_data_size": 4096,
      "max_io_size": 131072,
      "io_unit_size": 131072,
      "abort_timeout_sec": 1
    }
  ]
}
~~~

### nvmf_get_stats {#rpc_nvmf_get_stats}

Retrieve current statistics of the NVMf subsystem.

#### Parameters

{{ nvmf_get_stats_params }}

#### Response

The response is an object containing NVMf subsystem statistics.
In the response, `admin_qpairs` and `io_qpairs` are reflecting cumulative queue pair counts while
`current_admin_qpairs` and `current_io_qpairs` are showing the current number.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "nvmf_get_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tick_rate": 2400000000,
    "poll_groups": [
      {
        "name": "app_thread",
        "admin_qpairs": 1,
        "io_qpairs": 4,
        "current_admin_qpairs": 1,
        "current_io_qpairs": 2,
        "pending_bdev_io": 1721,
        "transports": [
          {
            "trtype": "RDMA",
            "pending_data_buffer": 12131888,
            "devices": [
              {
                "name": "mlx5_1",
                "polls": 72284105,
                "completions": 0,
                "requests": 0,
                "request_latency": 0,
                "pending_free_request": 0,
                "pending_rdma_read": 0,
                "pending_rdma_write": 0,
                "total_send_wrs": 0,
                "send_doorbell_updates": 0,
                "total_recv_wrs": 0,
                "recv_doorbell_updates": 1
              },
              {
                "name": "mlx5_0",
                "polls": 72284105,
                "completions": 15165875,
                "requests": 7582935,
                "request_latency": 1249323766184,
                "pending_free_request": 0,
                "pending_rdma_read": 337602,
                "pending_rdma_write": 0,
                "total_send_wrs": 15165875,
                "send_doorbell_updates": 1516587,
                "total_recv_wrs": 15165875,
                "recv_doorbell_updates": 1516587
              }
            ]
          }
        ]
      }
    ]
  }
}
~~~

### nvmf_set_crdt {#rpc_nvmf_set_crdt}

Set the 3 CRDT (Command Retry Delay Time) values. For details about
CRDT, please refer to the NVMe specification. Currently all the
SPDK nvmf subsystems share the same CRDT values. The default values
are 0. This rpc can only be invoked in STARTUP stage. All values are
in units of 100 milliseconds (same as the NVMe specification).

#### Parameters

{{ nvmf_set_crdt_params }}

## Vfio-user Target {#jsonrpc_components_vfu_tgt}

### vfu_tgt_set_base_path {#rpc_vfu_tgt_set_base_path}

Set base path of Unix Domain socket file.

#### Parameters

{{ vfu_tgt_set_base_path_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "path": "/var/run/vfu_tgt"
  },
  "jsonrpc": "2.0",
  "method": "vfu_tgt_set_base_path",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vfu_virtio_delete_endpoint {#rpc_vfu_virtio_delete_endpoint}

Delete PCI device via endpoint name.

#### Parameters

{{ vfu_virtio_delete_endpoint_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "vfu.0"
  },
  "jsonrpc": "2.0",
  "method": "vfu_virtio_delete_endpoint",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vfu_virtio_create_blk_endpoint {#rpc_vfu_virtio_create_blk_endpoint}

Create vfio-user virtio-blk PCI endpoint.

#### Parameters

{{ vfu_virtio_create_blk_endpoint_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "vfu.0",
    "bdev_name": "Malloc0",
    "cpumask": "0x2",
    "num_queues": 4,
    "qsize": 256
  },
  "jsonrpc": "2.0",
  "method": "vfu_virtio_create_blk_endpoint",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vfu_virtio_scsi_add_target {#rpc_vfu_virtio_scsi_add_target}

Add block device to specified SCSI target of vfio-user virtio-scsi PCI endpoint.

#### Parameters

{{ vfu_virtio_scsi_add_target_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "vfu.0",
    "scsi_target_num": 0,
    "bdev_name": "Malloc0"
  },
  "jsonrpc": "2.0",
  "method": "vfu_virtio_scsi_add_target",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vfu_virtio_scsi_remove_target {#rpc_vfu_virtio_scsi_remove_target}

Remove a SCSI target of vfio-user virtio-scsi PCI endpoint.

#### Parameters

{{ vfu_virtio_scsi_remove_target_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "vfu.0",
    "scsi_target_num": 0
  },
  "jsonrpc": "2.0",
  "method": "vfu_virtio_scsi_remove_target",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vfu_virtio_create_scsi_endpoint {#rpc_vfu_virtio_create_scsi_endpoint}

Create vfio-user virtio-scsi PCI endpoint.

#### Parameters

{{ vfu_virtio_create_scsi_endpoint_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "vfu.0",
    "cpumask": "0x2",
    "num_io_queues": 4,
    "qsize": 256
  },
  "jsonrpc": "2.0",
  "method": "vfu_virtio_create_scsi_endpoint",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vfu_virtio_create_fs_endpoint {#rpc_vfu_virtio_create_fs_endpoint}

Create vfio-user virtio-fs PCI endpoint.

#### Parameters

{{ vfu_virtio_create_fs_endpoint_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "vfu.0",
    "fsdev_name": "aio0",
    "tag": "virtiofs0",
    "cpumask": "0x2",
    "num_queues": 4,
    "qsize": 256
  },
  "jsonrpc": "2.0",
  "method": "vfu_virtio_create_fs_endpoint",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## Vhost Target {#jsonrpc_components_vhost_tgt}

The following common preconditions need to be met in all target types.

Controller name will be used to create UNIX domain socket. This implies that name concatenated with vhost socket
directory path needs to be valid UNIX socket name.

@ref cpu_mask parameter is used to choose CPU on which pollers will be launched when new initiator is connecting.
It must be a subset of application CPU mask. Default value is CPU mask of the application.

### vhost_controller_set_coalescing {#rpc_vhost_controller_set_coalescing}

Controls interrupt coalescing for specific target. Because `delay_base_us` is used to calculate delay in CPU ticks
there is no hardcoded limit for this parameter. Only limitation is that final delay in CPU ticks might not overflow
32 bit unsigned integer (which is more than 1s @ 4GHz CPU). In real scenarios `delay_base_us` should be much lower
than 150us. To disable coalescing set `delay_base_us` to 0.

#### Parameters

{{ vhost_controller_set_coalescing_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "iops_threshold": 100000,
    "ctrlr": "VhostScsi0",
    "delay_base_us": 80
  },
  "jsonrpc": "2.0",
  "method": "vhost_controller_set_coalescing",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vhost_create_scsi_controller {#rpc_vhost_create_scsi_controller}

Construct vhost SCSI target.

#### Parameters

{{ vhost_create_scsi_controller_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "cpumask": "0x2",
    "ctrlr": "VhostScsi0",
    "delay": true
  },
  "jsonrpc": "2.0",
  "method": "vhost_create_scsi_controller",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vhost_start_scsi_controller {#rpc_vhost_start_scsi_controller}

Start vhost SCSI controller, if controller is already started, do nothing.

#### Parameters

{{ vhost_start_scsi_controller_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "ctrlr": "VhostScsi0"
  },
  "jsonrpc": "2.0",
  "method": "vhost_start_scsi_controller",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vhost_scsi_controller_add_target {#rpc_vhost_scsi_controller_add_target}

In vhost target `ctrlr` create SCSI target with ID `scsi_target_num` and add `bdev_name` as LUN 0.

#### Parameters

{{ vhost_scsi_controller_add_target_params }}

#### Response

SCSI target ID.

#### Example

Example request:

~~~json
{
  "params": {
    "scsi_target_num": 1,
    "bdev_name": "Malloc0",
    "ctrlr": "VhostScsi0"
  },
  "jsonrpc": "2.0",
  "method": "vhost_scsi_controller_add_target",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 1
}
~~~

### vhost_scsi_controller_remove_target {#rpc_vhost_scsi_controller_remove_target}

Remove SCSI target ID `scsi_target_num` from vhost target `scsi_target_num`.

This method will fail if initiator is connected, but doesn't support hot-remove (the `VIRTIO_SCSI_F_HOTPLUG` is not negotiated).

#### Parameters

{{ vhost_scsi_controller_remove_target_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "scsi_target_num": 1,
    "ctrlr": "VhostScsi0"
  },
  "jsonrpc": "2.0",
  "method": "vhost_scsi_controller_remove_target",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### virtio_blk_create_transport {#rpc_virtio_blk_create_transport}

Create virtio blk transport.

#### Parameters

{{ virtio_blk_create_transport_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "vhost_user_blk"
  },
  "jsonrpc": "2.0",
  "method": "virtio_blk_create_transport",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### virtio_blk_get_transports {#rpc_virtio_blk_get_transports}

#### Parameters

The user may specify no parameters in order to list all transports,
or a transport name may be specified.

{{ virtio_blk_get_transports_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "virtio_blk_get_transports",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "vhost_user_blk"
    }
  ]
}
~~~

### vhost_create_blk_controller {#rpc_vhost_create_blk_controller}

Create vhost block controller

If `readonly` is `true` then vhost block target will be created as read only and fail any write requests.
The `VIRTIO_BLK_F_RO` feature flag will be offered to the initiator.

#### Parameters

{{ vhost_create_blk_controller_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "dev_name": "Malloc0",
    "ctrlr": "VhostBlk0"
  },
  "jsonrpc": "2.0",
  "method": "vhost_create_blk_controller",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vhost_get_controllers {#rpc_vhost_get_controllers}

Display information about all or specific vhost controller(s).

#### Parameters

The user may specify no parameters in order to list all controllers, or a controller may be
specified by name.

{{ vhost_get_controllers_params }}

#### Response

Response is an array of objects describing requested controller(s). Common fields are:

 Name             | Type   | Description
----------------- | ------ | ---------------------------------------------------------------
 ctrlr            | string | Controller name
 cpumask          | string | @ref cpu_mask of this controller
 delay_base_us    | number | Base (minimum) coalescing time in microseconds (0 if disabled)
 iops_threshold   | number | Coalescing activation level
 backend_specific | object | Backend specific information

##### Vhost block {#rpc_vhost_get_controllers_blk}

`backend_specific` contains one `block` object  of type:

{{ vhost_blk_controller_params_object }}

##### Vhost SCSI {#rpc_vhost_get_controllers_scsi}

`backend_specific` contains `scsi` array of following objects:

{{ vhost_scsi_controller_params_object }}

##### Vhost SCSI LUN {#rpc_vhost_get_controllers_scsi_luns}

Object of type:

{{ vhost_scsi_luns_controller_params_object }}

##### Vhost NVMe {#rpc_vhost_get_controllers_nvme}

`backend_specific` contains `namespaces` array of following objects:

{{ vhost_nvme_controller_params_object }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "vhost_get_controllers",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "cpumask": "0x2",
      "backend_specific": {
        "block": {
          "readonly": false,
          "bdev": "Malloc0"
        }
      },
      "iops_threshold": 60000,
      "ctrlr": "VhostBlk0",
      "delay_base_us": 100
    },
    {
      "cpumask": "0x2",
      "backend_specific": {
        "scsi": [
          {
            "target_name": "Target 2",
            "luns": [
              {
                "id": 0,
                "bdev_name": "Malloc1"
              }
            ],
            "id": 0,
            "scsi_dev_num": 2
          },
          {
            "target_name": "Target 5",
            "luns": [
              {
                "id": 0,
                "bdev_name": "Malloc2"
              }
            ],
            "id": 1,
            "scsi_dev_num": 5
          }
        ]
      },
      "iops_threshold": 60000,
      "ctrlr": "VhostScsi0",
      "delay_base_us": 0
    },
    {
      "cpumask": "0x2",
      "backend_specific": {
        "namespaces": [
          {
            "bdev": "Malloc3",
            "nsid": 1
          },
          {
            "bdev": "Malloc4",
            "nsid": 2
          }
        ]
      },
      "iops_threshold": 60000,
      "ctrlr": "VhostNvme0",
      "delay_base_us": 0
    }
  ]
}
~~~

### vhost_delete_controller {#rpc_vhost_delete_controller}

Remove vhost target.

This call will fail if there is an initiator connected or there is at least one SCSI target configured in case of
vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_vhost_scsi_controller_remove_target.

#### Parameters

{{ vhost_delete_controller_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "ctrlr": "VhostNvme0"
  },
  "jsonrpc": "2.0",
  "method": "vhost_delete_controller",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## Logical Volume {#jsonrpc_components_lvol}

Identification of logical volume store and logical volume is explained first.

A logical volume store has a UUID and a name for its identification.
The UUID is generated on creation and it can be used as a unique identifier.
The name is specified on creation and can be renamed.
Either UUID or name is used to access logical volume store in RPCs.

A logical volume has a UUID and a name for its identification.
The UUID of the logical volume is generated on creation and it can be unique identifier.
The alias of the logical volume takes the format _lvs_name/lvol_name_ where:

* _lvs_name_ is the name of the logical volume store.
* _lvol_name_ is specified on creation and can be renamed.

### bdev_lvol_create_lvstore {#rpc_bdev_lvol_create_lvstore}

Construct a logical volume store.

#### Parameters

The num_md_pages_per_cluster_ratio defines the amount of metadata to
allocate when the logical volume store is created. The default value
is '100', which translates to 1 4KiB per cluster. For the default 4MiB
cluster size, this equates to about 0.1% of the underlying block
device allocated for metadata. Logical volume stores can be grown, if
the size of the underlying block device grows in the future, but only
if enough metadata pages were allocated to support the growth. So
num_md_pages_per_cluster_ratio should be set to a higher value if
wanting to support future growth. For example,
num_md_pages_per_cluster_ratio = 200 would support future 2x growth of
the logical volume store, and would result in 0.2% of the underlying
block device allocated for metadata (with a default 4MiB cluster
size). The amount of future growth can be determined with the `max_growable_size`
parameter from the bdev_lvol_get_lvstores RPC.

{{ bdev_lvol_create_lvstore_params }}

#### Response

UUID of the created logical volume store is returned.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bdev_lvol_create_lvstore",
  "params": {
    "lvs_name": "LVS0",
    "bdev_name": "Malloc0",
    "clear_method": "write_zeroes",
    "md_page_size": "4096"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
}
~~~

### bdev_lvol_delete_lvstore {#rpc_bdev_lvol_delete_lvstore}

Destroy a logical volume store.

#### Parameters

Either uuid or lvs_name must be specified, but not both.

{{ bdev_lvol_delete_lvstore_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_delete_lvstore",
  "id": 1,
  "params": {
    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_get_lvstores {#rpc_bdev_lvol_get_lvstores}

Get a list of logical volume stores.

#### Parameters

Either uuid or lvs_name may be specified, but not both.
If both uuid and lvs_name are omitted, information about all logical volume stores is returned.

{{ bdev_lvol_get_lvstores_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_get_lvstores",
  "id": 1,
  "params": {
    "lvs_name": "LVS0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5",
      "base_bdev": "Malloc0",
      "free_clusters": 31,
      "cluster_size": 4194304,
      "total_data_clusters": 31,
      "block_size": 4096,
      "name": "LVS0",
      "max_growable_size": 137271181312
   }
  ]
}
~~~

### bdev_lvol_rename_lvstore {#rpc_bdev_lvol_rename_lvstore}

Rename a logical volume store.

#### Parameters

{{ bdev_lvol_rename_lvstore_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_rename_lvstore",
  "id": 1,
  "params": {
    "old_name": "LVS0",
    "new_name": "LVS2"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_grow_lvstore {#rpc_bdev_lvol_grow_lvstore}

Grow the logical volume store to fill the underlying bdev

Growth is limited by the number of metadata pages allocated when the lvstore was created,
and its specific max size can be found using the `max_growable_size` parameter from the
bdev_lvol_get_lvstores RPC.

This RPC can be called to grow an lvolstore when the underlying bdev has increased in size.

#### Parameters

Either uuid or lvs_name must be specified, but not both.

{{ bdev_lvol_grow_lvstore_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_grow_lvstore",
  "id": 1,
  "params": {
    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_create {#rpc_bdev_lvol_create}

Create a logical volume on a logical volume store.

#### Parameters

Size will be rounded up to a multiple of cluster size. Either uuid or lvs_name must be specified, but not both.
lvol_name will be used in the alias of the created logical volume.

{{ bdev_lvol_create_params }}

#### Response

UUID of the created logical volume is returned.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_create",
  "id": 1,
  "params": {
    "lvol_name": "LVOL0",
    "size_in_mib": 1,
    "lvs_name": "LVS0",
    "clear_method": "unmap",
    "thin_provision": true
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "1b38702c-7f0c-411e-a962-92c6a5a8a602"
}
~~~

### bdev_lvol_snapshot {#rpc_bdev_lvol_snapshot}

Capture a snapshot of the current state of a logical volume.

#### Parameters

{{ bdev_lvol_snapshot_params }}

#### Response

UUID of the created logical volume snapshot is returned.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_snapshot",
  "id": 1,
  "params": {
    "lvol_name": "1b38702c-7f0c-411e-a962-92c6a5a8a602",
    "snapshot_name": "SNAP1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670"
}
~~~

### bdev_lvol_clone {#rpc_bdev_lvol_clone}

Create a logical volume based on a snapshot.

#### Parameters

{{ bdev_lvol_clone_params }}

#### Response

UUID of the created logical volume clone is returned.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_clone",
  "id": 1,
  "params": {
    "snapshot_name": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670",
    "clone_name": "CLONE1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "8d87fccc-c278-49f0-9d4c-6237951aca09"
}
~~~

### bdev_lvol_clone_bdev {#rpc_bdev_lvol_clone_bdev}

Create a logical volume based on an external snapshot bdev. The external snapshot bdev
is a bdev that will not be written to by any consumer and must not be an lvol in the
lvstore as the clone.

Regardless of whether the bdev is specified by name or UUID, the bdev UUID will be stored
in the logical volume's metadata for use while the lvolstore is loading. For this reason,
it is important that the bdev chosen has a static UUID.

#### Parameters

{{ bdev_lvol_clone_bdev_params }}

#### Response

UUID of the created logical volume clone is returned.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_clone_bdev",
  "id": 1,
  "params": {
    "bdev": "e4b40d8b-f623-416d-8234-baf5a4c83cbd",
    "lvs_name": "lvs1",
    "clone_name": "clone2"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "336f662b-08e5-4006-8e06-e2023f7f9886"
}
~~~

### bdev_lvol_rename {#rpc_bdev_lvol_rename}

Rename a logical volume. New name will rename only the alias of the logical volume.

#### Parameters

{{ bdev_lvol_rename_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_rename",
  "id": 1,
  "params": {
    "old_name": "067df606-6dbc-4143-a499-0d05855cb3b8",
    "new_name": "LVOL2"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_resize {#rpc_bdev_lvol_resize}

Resize a logical volume.

#### Parameters

{{ bdev_lvol_resize_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_resize",
  "id": 1,
  "params": {
    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
    "size_in_mib": 2
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_set_read_only {#rpc_bdev_lvol_set_read_only}

Mark logical volume as read only.

#### Parameters

{{ bdev_lvol_set_read_only_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_set_read_only",
  "id": 1,
  "params": {
    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_delete {#rpc_bdev_lvol_delete}

Destroy a logical volume.

#### Parameters

{{ bdev_lvol_delete_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_delete",
  "id": 1,
  "params": {
    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_inflate {#rpc_bdev_lvol_inflate}

Inflate a logical volume. All unallocated clusters are allocated and copied from the parent or zero filled
if not allocated in the parent. Then all dependencies on the parent are removed.

#### Parameters

{{ bdev_lvol_inflate_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_inflate",
  "id": 1,
  "params": {
    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_decouple_parent {#rpc_bdev_lvol_decouple_parent}

Decouple the parent of a logical volume. For unallocated clusters which is allocated in the parent, they are
allocated and copied from the parent, but for unallocated clusters which is thin provisioned in the parent,
they are kept thin provisioned. Then all dependencies on the parent are removed.

#### Parameters

{{ bdev_lvol_decouple_parent_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_decouple_parent",
  "id": 1,
  "params": {
    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_get_lvols {#rpc_bdev_lvol_get_lvols}

Get a list of logical volumes. This list can be limited by lvol store and will display volumes even if
they are degraded. Degraded lvols do not have an associated bdev, thus this RPC call may return lvols
not returned by `bdev_get_bdevs`.

#### Parameters

Either lvs_uuid or lvs_name may be specified, but not both.
If both lvs_uuid and lvs_name are omitted, information about lvols in all logical volume stores is returned.

{{ bdev_lvol_get_lvols_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_get_lvols",
  "id": 1,
  "params": {
    "lvs_name": "lvs_test"
  }
}
~~~

Example response:

~~~json
[
  {
    "alias": "lvs_test/lvol1",
    "uuid": "b335c368-851d-4099-81e0-018cc494fdf6",
    "name": "lvol1",
    "is_thin_provisioned": false,
    "is_snapshot": false,
    "is_clone": false,
    "is_esnap_clone": false,
    "is_degraded": false,
    "lvs": {
      "name": "lvs_test",
      "uuid": "a1c8d950-5715-4558-936d-ab9e6eca0794"
    }
  }
]
~~~

### bdev_lvol_set_parent {#rpc_bdev_lvol_set_parent}

Set a snapshot as the parent of a lvol, making the lvol a clone of this snapshot.
The previous parent of the lvol, if any, can be another snapshot or an external snapshot; if the
lvol is not a clone, it must be thin-provisioned.
Lvol and parent snapshot must have the same size and must belong to the same lvol store.

#### Parameters

{{ bdev_lvol_set_parent_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_set_parent",
  "id": 1,
  "params": {
    "lvol_name": "LVS1/LVOL0",
    "parent_name": "LVS1/SNAP0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_set_parent_bdev {#rpc_bdev_lvol_set_parent_bdev}

Set an external snapshot as the parent of a lvol, making the lvol a clone of this external
snapshot (see @ref rpc_bdev_lvol_clone_bdev).
The previous parent of the lvol, if any, can be another external snapshot or a snapshot; if the
lvol is not a clone, it must be thin-provisioned.
The size of the external snapshot device must be an integer multiple of cluster size of lvol's lvolstore.

#### Parameters

{{ bdev_lvol_set_parent_bdev_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_set_parent_bdev",
  "id": 1,
  "params": {
    "lvol_name": "LVS1/LVOL0",
    "parent_name": "e465527b-f412-4f70-a03e-c4a5d608f65e"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_start_shallow_copy {#rpc_bdev_lvol_start_shallow_copy}

Start a shallow copy of an lvol over a given bdev. Only clusters allocated to the lvol will be written on the bdev.
Must have:

* lvol read only
* lvol size less or equal than bdev size
* lvstore block size an even multiple of bdev block size

#### Parameters

{{ bdev_lvol_start_shallow_copy_params }}

#### Response

This RPC starts the operation and return an identifier that can be used to query the status of the operation
with the RPC @ref rpc_bdev_lvol_check_shallow_copy.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_start_shallow_copy",
  "id": 1,
  "params": {
    "src_lvol_name": "8a47421a-20cf-444f-845c-d97ad0b0bd8e",
    "dst_bdev_name": "Nvme1n1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "operation_id": 7
  }
}
~~~

### bdev_lvol_check_shallow_copy {#rpc_bdev_lvol_check_shallow_copy}

Get shallow copy status.

#### Parameters

{{ bdev_lvol_check_shallow_copy_params }}

#### Response

Get info about the shallow copy operation identified by operation id.
It reports operation's status, which can be `in progress`, `complete` or `error`,
the actual number of copied clusters, the total number of clusters to copy and,
in case of error, a description.
Once the operation is ended and the result has been retrieved, the
operation is removed from the internal list of ended operation, so its
result cannot be accessed anymore.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_check_shallow_copy",
  "id": 1,
  "params": {
    "operation_id": 7
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "state": "in progress",
    "copied_clusters": 2,
    "total_clusters": 4
  }
}
~~~

## RAID {#jsonrpc_components_raid}

### bdev_raid_set_options {#rpc_bdev_raid_set_options}

Set options for bdev raid.

This RPC can be called at any time, but the new value will only take effect for new raid bdevs.

The `process_window_size_kb` parameter defines the size of the "window" (LBA range of the raid bdev)
in which a background process like rebuild performs its work. Any positive value is valid, but the value
actually used by a raid bdev can be adjusted to the size of the raid bdev or the write unit size.
`process_max_bandwidth_mb_sec` parameter defines the maximum bandwidth used by a background process like
rebuild. Any positive value or zero is valid, zero means no bandwidth limitation for background process.
It can only limit the process bandwidth but doesn't guarantee it can be reached. Changing this value will
not affect existing processes, it will only take effect on new processes generated after the RPC is completed.

#### Parameters

{{ bdev_raid_set_options_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_raid_set_options",
  "id": 1,
  "params": {
    "process_window_size_kb": 512,
    "process_max_bandwidth_mb_sec": 100
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_raid_get_bdevs {#rpc_bdev_raid_get_bdevs}

This is used to list all the raid bdev details based on the input category requested. Category should be one
of 'all', 'online', 'configuring' or 'offline'. 'all' means all the raid bdevs whether they are online or
configuring or offline. 'online' is the raid bdev which is registered with bdev layer. 'configuring' is
the raid bdev which does not have full configuration discovered yet. 'offline' is the raid bdev which is
not registered with bdev as of now and it has encountered any error or user has requested to offline
the raid bdev.

#### Parameters

{{ bdev_raid_get_bdevs_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_raid_get_bdevs",
  "id": 1,
  "params": {
    "category": "all"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "RaidBdev0",
      "uuid": "7d352e83-fe27-40f2-8fef-64563355e076",
      "strip_size_kb": 128,
      "state": "online",
      "raid_level": "raid0",
      "num_base_bdevs": 2,
      "num_base_bdevs_discovered": 2,
      "num_base_bdevs_operational": 2,
      "base_bdevs_list": [
        {
          "name": "malloc0",
          "uuid": "d2788884-5b3e-4fd7-87ff-6c78177e14ab",
          "is_configured": true,
          "data_offset": 256,
          "data_size": 261888
        },
        {
          "name": "malloc1",
          "uuid": "a81bb1f8-5865-488a-8758-10152017e7d1",
          "is_configured": true,
          "data_offset": 256,
          "data_size": 261888
        }
      ]
    },
    {
      "name": "RaidBdev1",
      "uuid": "f7cb71ed-2d0e-4240-979e-27b0b7735f36",
      "strip_size_kb": 128,
      "state": "configuring",
      "raid_level": "raid0",
      "num_base_bdevs": 2,
      "num_base_bdevs_discovered": 1,
      "num_base_bdevs_operational": 2,
      "base_bdevs_list": [
        {
          "name": "malloc2",
          "uuid": "f60c20e1-3439-4f89-ae55-965a70333f86",
          "is_configured": true,
          "data_offset": 256,
          "data_size": 261888
        },
        {
          "name": "malloc3",
          "uuid": "00000000-0000-0000-0000-000000000000",
          "is_configured": false,
          "data_offset": 0,
          "data_size": 0
        }
      ]
    }
  ]
}
~~~

### bdev_raid_create {#rpc_bdev_raid_create}

Constructs new RAID bdev.

#### Parameters

{{ bdev_raid_create_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_raid_create",
  "id": 1,
  "params": {
    "name": "Raid0",
    "raid_level": "0",
    "base_bdevs": [
      "Malloc0",
      "Malloc1",
      "Malloc2",
      "Malloc3"
    ],
    "strip_size_kb": 4
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_raid_delete {#rpc_bdev_raid_delete}

Removes RAID bdev.

#### Parameters

{{ bdev_raid_delete_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_raid_delete",
  "id": 1,
  "params": {
    "name": "Raid0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_raid_add_base_bdev {#rpc_bdev_raid_add_base_bdev}

Add base bdev to existing raid bdev. The raid bdev must have an empty base bdev slot.
The bdev must be large enough and have the same block size and metadata format as the other base bdevs.

#### Parameters

{{ bdev_raid_add_base_bdev_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_raid_add_base_bdev",
  "id": 1,
  "params": {
    "raid_bdev": "RaidBdev0",
    "base_bdev": "Nvme0n1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_raid_remove_base_bdev {#rpc_bdev_raid_remove_base_bdev}

Remove base bdev from existing raid bdev.

#### Parameters

{{ bdev_raid_remove_base_bdev_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_raid_remove_base_bdev",
  "id": 1,
  "params": {
    "name": "Raid0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## SPLIT {#jsonrpc_components_split}

### bdev_split_create {#rpc_bdev_split_create}

This is used to split an underlying block device and create several smaller equal-sized vbdevs.

#### Parameters

{{ bdev_split_create_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_split_create",
  "id": 1,
  "params": {
    "base_bdev": "Malloc0",
    "split_count": 4
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "Malloc0p0",
    "Malloc0p1",
    "Malloc0p2",
    "Malloc0p3"
  ]
}
~~~

### bdev_split_delete {#rpc_bdev_split_delete}

This is used to remove the split vbdevs.

#### Parameters

{{ bdev_split_delete_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_split_delete",
  "id": 1,
  "params": {
    "base_bdev": "Malloc0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## Uring {#jsonrpc_components_uring}

### bdev_uring_create {#rpc_bdev_uring_create}

Create a bdev with io_uring backend.

#### Parameters

{{ bdev_uring_create_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_uring_create",
  "id": 1,
  "params": {
    "name": "bdev_u0",
    "filename": "/dev/nvme0n1",
    "block_size": 512
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "bdev_u0"
}
~~~

### bdev_uring_rescan {#rpc_bdev_uring_rescan}

Rescan the size of a uring bdev.

#### Parameters

{{ bdev_uring_rescan_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_uring_rescan",
  "id": 1,
  "params": {
    "name": "bdev_u0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_uring_delete {#rpc_bdev_uring_delete}

Remove a uring bdev.

#### Parameters

{{ bdev_uring_delete_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_uring_delete",
  "id": 1,
  "params": {
    "name": "bdev_u0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## OPAL {#jsonrpc_components_opal}

### bdev_nvme_opal_init {#rpc_bdev_nvme_opal_init}

This is used to initialize OPAL of a given NVMe ctrlr, including taking ownership and activating.

#### Parameters

{{ bdev_nvme_opal_init_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_opal_init",
  "id": 1,
  "params": {
    "nvme_ctrlr_name": "nvme0",
    "password": "*****"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_opal_revert {#rpc_bdev_nvme_opal_revert}

This is used to revert OPAL to its factory settings. Erase all user configuration and data.

#### Parameters

{{ bdev_nvme_opal_revert_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_opal_revert",
  "id": 1,
  "params": {
    "nvme_ctrlr_name": "nvme0",
    "password": "*****"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_opal_create {#rpc_bdev_opal_create}

This is used to create an OPAL virtual bdev.

#### Parameters

{{ bdev_opal_create_params }}

#### Response

The response is the name of created OPAL virtual bdev.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_opal_create",
  "id": 1,
  "params": {
    "nvme_ctrlr_name": "nvme0",
    "nsid": 1,
    "locking_range_id": 1,
    "range_start": 0,
    "range_length": 4096,
    "password": "*****"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "nvme0n1r1"
}
~~~

### bdev_opal_get_info {#rpc_bdev_opal_get_info}

This is used to get information of a given OPAL bdev.

#### Parameters

{{ bdev_opal_get_info_params }}

#### Response

The response is the locking info of OPAL virtual bdev.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_opal_get_info",
  "id": 1,
  "params": {
    "bdev_name": "nvme0n1r1",
    "password": "*****"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "name": "nvme0n1r1",
    "range_start": 0,
    "range_length": 4096,
    "read_lock_enabled": true,
    "write_lock_enabled": true,
    "read_locked": false,
    "write_locked": false
  }
}
~~~

### bdev_opal_delete {#rpc_bdev_opal_delete}

This is used to delete OPAL vbdev.

#### Parameters

{{ bdev_opal_delete_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_opal_delete",
  "id": 1,
  "params": {
    "bdev_name": "nvme0n1r1",
    "password": "*****"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_opal_new_user {#rpc_bdev_opal_new_user}

This enables a new user to the specified opal bdev so that the user can lock/unlock the bdev.
Recalling this for the same opal bdev, only the newest user will have the privilege.

#### Parameters

{{ bdev_opal_new_user_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_opal_new_user",
  "id": 1,
  "params": {
    "bdev_name": "nvme0n1r1",
    "admin_password": "*****",
    "user_id": "1",
    "user_password": "********"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_opal_set_lock_state {#rpc_bdev_opal_set_lock_state}

This is used to lock/unlock specific opal bdev providing user ID and password.

#### Parameters

{{ bdev_opal_set_lock_state_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_opal_set_lock_state",
  "id": 1,
  "params": {
    "bdev_name": "nvme0n1r1",
    "user_id": "1",
    "user_password": "********",
    "lock_state": "rwlock"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## Notifications {#jsonrpc_components_notify}

### notify_get_types {#rpc_notify_get_types}

Return list of all supported notification types.

#### Parameters

{{ notify_get_types_params }}

#### Response

The response is an array of strings - supported RPC notification types.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "notify_get_types",
  "id": 1
}
~~~

Example response:

~~~json
{
  "id": 1,
  "result": [
    "bdev_register",
    "bdev_unregister"
  ],
  "jsonrpc": "2.0"
}
~~~

### notify_get_notifications {#rpc_notify_get_notifications}

Request notifications. Returns array of notifications that happened since the specified id (or first that is available).

Notice: Notifications are kept in circular buffer with limited size. Older notifications might be inaccessible
due to being overwritten by new ones.

#### Parameters

{{ notify_get_notifications_params }}

#### Response

Response is an array of event objects.

 Name   | Type   | Description
------- | ------ | -------------------
 id     | number | Event ID.
 type   | number | Type of the event.
 ctx    | string | Event context.

#### Example

Example request:

~~~json
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "notify_get_notifications",
  "params": {
    "id": 1,
    "max": 10
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "ctx": "Malloc0",
      "type": "bdev_register",
      "id": 1
    },
    {
      "ctx": "Malloc2",
      "type": "bdev_register",
      "id": 2
    }
  ]
}
~~~

## Keyring {#jsonrpc_components_keyring}

### keyring_file_add_key {#rpc_keyring_file_add_key}

Add a file-based key to a keyring.

#### Parameters

{{ keyring_file_add_key_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "keyring_file_add_key",
  "id": 1,
  "params": {
    "name": "key0",
    "path": "/path/to/key0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### keyring_file_remove_key {#rpc_keyring_file_remove_key}

Remove a file-based key from a keyring.

#### Parameters

{{ keyring_file_remove_key_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "keyring_file_remove_key",
  "id": 1,
  "params": {
    "name": "key0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### keyring_get_keys {#rpc_keyring_get_keys}

Get a list of available keys.  This RPC will only list keys that are currently attached to a
keyring.  Dynamically loaded keys (via the `probe_key()` callback) will only be included if they're
currently in-use (i.e. with active references obtained via `spdk_keyring_get_key()`).

#### Parameters

{{ keyring_get_keys_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "keyring_get_keys",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "name": "key0",
      "module": "keyring_file",
      "removed": false,
      "probed": false,
      "refcnt": 1,
      "path": "/path/to/key0"
    },
    {
      "name": "key1",
      "module": "keyring_file",
      "removed": false,
      "probed": false,
      "refcnt": 1,
      "path": "/path/to/key1"
    }
  ]
}
~~~

### keyring_linux_set_options {#rpc_keyring_linux_set_options}

Set options of the keyring_linux module.

#### Parameters

{{ keyring_linux_set_options_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "keyring_linux_set_options",
  "id": 1,
  "params": {
    "enable": true
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## Linux Userspace Block Device (UBLK) {#jsonrpc_components_ublk}

SPDK supports exporting bdevs though Linux ublk. The motivation behind it is to back a Linux kernel block device
with an SPDK user space bdev.

To export a device over ublk, first make sure the Linux kernel ublk driver is loaded by running 'modprobe ublk_drv'.

### ublk_create_target {#rpc_ublk_create_target}

Start to create ublk threads and initialize ublk target. It will return an error if user calls this RPC twice without
ublk_destroy_target in between. It will use current cpumask in SPDK when user does not specify cpumask option.

#### Parameters

{{ ublk_create_target_params }}

#### Response

 Name   | Type    | Description
------- | ------- | -------------------------------------------------------------------
 result | boolean | True if ublk target initialization is successful; False if failed.

#### Example

Example request:

~~~json
{
  "params": {
    "cpumask": "0x2"
  },
  "jsonrpc": "2.0",
  "method": "ublk_create_target",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### ublk_destroy_target {#rpc_ublk_destroy_target}

Release all UBLK devices and destroy ublk target.

#### Parameters

{{ ublk_destroy_target_params }}

#### Response

 Name   | Type    | Description
------- | ------- | ----------------------------------------------------------------
 result | boolean | True if ublk target destruction is successful; False if failed.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "ublk_destroy_target",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### ublk_start_disk {#rpc_ublk_start_disk}

Start to export one SPDK bdev as a UBLK device

#### Parameters

{{ ublk_start_disk_params }}

#### Response

 Name   | Type   | Description
------- | ------ | ---------------
 result | int    | UBLK device ID

#### Example

Example request:

~~~json
{
  "params": {
    "ublk_id": "1",
    "bdev_name": "Malloc1"
  },
  "jsonrpc": "2.0",
  "method": "ublk_start_disk",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 1
}
~~~

### ublk_recover_disk {#rpc_ublk_recover_disk}

Recover original UBLK device with ID and block device

#### Parameters

{{ ublk_recover_disk_params }}

#### Response

 Name   | Type   | Description
------- | ------ | ---------------
 result | int    | UBLK device ID

#### Example

Example request:

~~~json
{
  "params": {
    "ublk_id": "1",
    "bdev_name": "Malloc1"
  },
  "jsonrpc": "2.0",
  "method": "ublk_recover_disk",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 1
}
~~~

### ublk_stop_disk {#rpc_ublk_stop_disk}

Delete a UBLK device

#### Parameters

{{ ublk_stop_disk_params }}

#### Response

 Name   | Type    | Description
------- | ------- | --------------------------------------------------------------
 result | boolean | True if UBLK device is deleted successfully; False if failed.

#### Example

Example request:

~~~json
{
  "params": {
    "ublk_id": "1"
  },
  "jsonrpc": "2.0",
  "method": "ublk_stop_disk",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### ublk_get_disks {#rpc_ublk_get_disks}

Display full or specified ublk device list

#### Parameters

{{ ublk_get_disks_params }}

#### Response

 Name        | Type   | Description
------------ | ------ | --------------
 ublk_device | string | path to the ublk device node
 id          | int    | device id
 queue_depth | int    | queue depth supported for each queue
 num_queues  | int    | number of queues supported by the ublk device
 bdev_name   | string | name of the bdev backing the ublk device

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "ublk_get_disks",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "ublk_device": "/dev/ublkb1",
      "id": 1,
      "queue_depth": 512,
      "num_queues": 1,
      "bdev_name": "Malloc1"
    }
  ]
}
~~~

## Linux Network Block Device (NBD) {#jsonrpc_components_nbd}

SPDK supports exporting bdevs through Linux nbd. These devices then appear as standard Linux kernel block devices
and can be accessed using standard utilities like fdisk.

In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'.

### nbd_start_disk {#rpc_nbd_start_disk}

Start to export one SPDK bdev as NBD disk

#### Parameters

{{ nbd_start_disk_params }}

#### Response

Path of exported NBD disk

#### Example

Example request:

~~~json
{
  "params": {
    "nbd_device": "/dev/nbd1",
    "bdev_name": "Malloc1"
  },
  "jsonrpc": "2.0",
  "method": "nbd_start_disk",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "/dev/nbd1"
}
~~~

### nbd_stop_disk {#rpc_nbd_stop_disk}

Stop one NBD disk which is based on SPDK bdev.

#### Parameters

{{ nbd_stop_disk_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "nbd_device": "/dev/nbd1"
  },
  "jsonrpc": "2.0",
  "method": "nbd_stop_disk",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "true"
}
~~~

### nbd_get_disks {#rpc_nbd_get_disks}

Display all or specified NBD device list

#### Parameters

{{ nbd_get_disks_params }}

#### Response

The response is an array of exported NBD devices and their corresponding SPDK bdev.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "nbd_get_disks",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "bdev_name": "Malloc0",
      "nbd_device": "/dev/nbd0"
    },
    {
      "bdev_name": "Malloc1",
      "nbd_device": "/dev/nbd1"
    }
  ]
}
~~~

## Socket layer {#jsonrpc_components_sock}

### sock_impl_get_options {#rpc_sock_impl_get_options}

Get parameters for the socket layer implementation.

#### Parameters

{{ sock_impl_get_options_params }}

#### Response

Response is an object with current socket layer options for requested implementation.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "sock_impl_get_options",
  "id": 1,
  "params": {
    "impl_name": "posix"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "recv_buf_size": 2097152,
    "send_buf_size": 2097152,
    "enable_recv_pipe": true,
    "enable_quickack": true,
    "enable_placement_id": 0,
    "enable_zerocopy_send_server": true,
    "enable_zerocopy_send_client": false,
    "zerocopy_threshold": 0,
    "tls_version": 13,
    "enable_ktls": false
  }
}
~~~

### sock_impl_set_options {#rpc_sock_impl_set_options}

Set parameters for the socket layer implementation.

#### Parameters

{{ sock_impl_set_options_params }}

#### Response

 Name   | Type    | Description
------- | ------- | ----------------------------------------------------
 result | boolean | True if socket layer options were set successfully.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "sock_impl_set_options",
  "id": 1,
  "params": {
    "impl_name": "posix",
    "recv_buf_size": 2097152,
    "send_buf_size": 2097152,
    "enable_recv_pipe": false,
    "enable_quickack": false,
    "enable_placement_id": 0,
    "enable_zerocopy_send_server": true,
    "enable_zerocopy_send_client": false,
    "zerocopy_threshold": 10240,
    "tls_version": 13,
    "enable_ktls": false
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### sock_set_default_impl {#rpc_sock_set_default_impl}

Set the default sock implementation.

#### Parameters

{{ sock_set_default_impl_params }}

#### Response

 Name   | Type    | Description
------- | ------- | ---------------------------------------------------------------------
 result | boolean | True if the default socket layer configuration was set successfully.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "sock_set_default_impl",
  "id": 1,
  "params": {
    "impl_name": "posix"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### sock_get_default_impl {#rpc_sock_get_default_impl}

Get the name of the default sock implementation.

#### Parameters

{{ sock_get_default_impl_params }}

#### Response

 Name      | Type   | Description
---------- | ------ | -------------------------------------------------------
 impl_name | string | The name of the current default socket implementation.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "sock_get_default_impl",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "impl_name": "posix"
  }
}
~~~

## Miscellaneous RPC commands {#jsonrpc_components_misc}

### bdev_nvme_send_cmd {#rpc_bdev_nvme_send_cmd}

Send NVMe command directly to NVMe controller or namespace. Parameters and responses encoded by base64 urlsafe need further processing.

Notice: bdev_nvme_send_cmd requires user to guarantee the correctness of NVMe command itself, and also optional parameters.
Illegal command contents or mismatching buffer size may result in unpredictable behavior.

#### Parameters

{{ bdev_nvme_send_cmd_params }}

#### Response

 Name     | Type   | Description
--------- | ------ | ------------------------------------------------------------------------
 cpl      | string | NVMe completion queue entry, encoded by base64 urlsafe
 data     | string | Data transferred from controller to host, encoded by base64 urlsafe
 metadata | string | Metadata transferred from controller to host, encoded by base64 urlsafe

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_send_cmd",
  "id": 1,
  "params": {
    "name": "Nvme0",
    "cmd_type": "admin",
    "data_direction": "c2h",
    "cmdbuf": "BgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAsGUs9P5_AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
    "data_len": 60
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "cpl": "AAAAAAAAAAARAAAAWrmwABAA==",
    "data": "sIjg6AAAAACwiODoAAAAALCI4OgAAAAAAAYAAREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  }
}
~~~

### vmd_enable {#rpc_vmd_enable}

Enable VMD enumeration.

#### Parameters

{{ vmd_enable_params }}

#### Response

Completion status of enumeration is returned as a boolean.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "vmd_enable",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vmd_remove_device {#rpc_vmd_remove_device}

Remove a device behind a VMD.

#### Parameters

{{ vmd_remove_device_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "vmd_remove_device",
  "params": {
    "addr": "5d0505:01:00.0"
  },
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### vmd_rescan {#rpc_vmd_rescan}

Force a rescan of the devices behind VMD.

#### Parameters

{{ vmd_rescan_params }}

#### Response

The response is the number of new devices found.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "vmd_rescan",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "count": 1
  }
}
~~~

### spdk_get_version {#rpc_spdk_get_version}

Get the version info of the running SPDK application.

#### Parameters

{{ spdk_get_version_params }}

#### Response

The response is the version number including major version number, minor version number, patch level number and suffix string.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "spdk_get_version"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "version": "19.04-pre",
    "fields": {
      "major": 19,
      "minor": 4,
      "patch": 0,
      "suffix": "-pre"
    }
  }
}
~~~

### framework_get_pci_devices {#rpc_framework_get_pci_devices}

List PCIe devices attached to an SPDK application and the contents of their config space.

#### Parameters

{{ framework_get_pci_devices_params }}

#### Response

The response is an array of attached PCIe devices.

#### Example

Note that the config space buffer was trimmed.

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "framework_get_pci_devices"
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "0000:00:04.0",
      "config_space": "8680455807051000...0000000000000000"
    },
    {
      "address": "0000:00:03.0",
      "config_space": "8680455807051000...0000000000000000"
    }
  ]
}
~~~

### bdev_nvme_add_error_injection {#rpc_bdev_nvme_add_error_injection}

Add a NVMe command error injection for a bdev nvme controller.

#### Parameters

{{ bdev_nvme_add_error_injection_params }}

#### Response

true on success

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_add_error_injection",
  "id": 1,
  "params": {
    "name": "HotInNvme0",
    "opc": 2,
    "cmd_type": "io",
    "err_count": 1111111,
    "sct": 11,
    "sc": 33
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_remove_error_injection {#rpc_bdev_nvme_remove_error_injection}

Remove a NVMe command error injection.

#### Parameters

{{ bdev_nvme_remove_error_injection_params }}

#### Response

true on success

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_remove_error_injection",
  "id": 1,
  "params": {
    "name": "HotInNvme0",
    "opc": 2,
    "cmd_type": "io"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_daos_create {#rpc_bdev_daos_create}

Construct @ref bdev_config_daos

#### Parameters

To find more about various object classes please visit [DAOS documentation](https://github.com/daos-stack/daos/blob/master/src/object/README.md).
Please note, that DAOS bdev module uses the same CLI flag notation as `dmg` and `daos` commands,
for instance, `SX` or `EC_4P2G2` rather than in DAOS header file `OC_SX` or `OC_EC_4P2G2`.

{{ bdev_daos_create_params }}

#### Response

Name of newly created bdev.

#### Example

Example request:

~~~json
{
  "params": {
    "block_size": 4096,
    "num_blocks": 16384,
    "name": "daosdev0",
    "pool": "test-pool",
    "cont": "test-cont",
    "oclass": "EC_4P2G2"
  },
  "jsonrpc": "2.0",
  "method": "bdev_daos_create",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "daosdev0"
}
~~~

### bdev_daos_delete {#rpc_bdev_daos_delete}

Delete @ref bdev_config_daos

#### Parameters

{{ bdev_daos_delete_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "daosdev0"
  },
  "jsonrpc": "2.0",
  "method": "bdev_daos_delete",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_daos_resize {#rpc_bdev_daos_resize}

Resize @ref bdev_config_daos.

#### Parameters

{{ bdev_daos_resize_params }}

#### Example

Example request:

~~~json
{
  "params": {
    "name": "daosdev0",
    "new_size": 8192
  },
  "jsonrpc": "2.0",
  "method": "bdev_daos_resize",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iobuf_set_options {#rpc_iobuf_set_options}

Set iobuf buffer pool options.

#### Parameters

{{ iobuf_set_options_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "iobuf_set_options",
  "params": {
    "small_pool_count": 16383,
    "large_pool_count": 2047
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### iobuf_get_stats {#rpc_iobuf_get_stats}

Retrieve iobuf's statistics.

#### Parameters

{{ iobuf_get_stats_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "iobuf_get_stats",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "module": "accel",
      "small_pool": {
        "cache": 0,
        "main": 0,
        "retry": 0
      },
      "large_pool": {
        "cache": 0,
        "main": 0,
        "retry": 0
      }
    },
    {
      "module": "bdev",
      "small_pool": {
        "cache": 421965,
        "main": 1218,
        "retry": 0
      },
      "large_pool": {
        "cache": 0,
        "main": 0,
        "retry": 0
      }
    },
    {
      "module": "nvmf_TCP",
      "small_pool": {
        "cache": 7,
        "main": 0,
        "retry": 0
      },
      "large_pool": {
        "cache": 0,
        "main": 0,
        "retry": 0
      }
    }
  ]
}
~~~

### bdev_nvme_start_mdns_discovery {#rpc_bdev_nvme_start_mdns_discovery}

Starts an mDNS based discovery service for the specified service type for the
auto-discovery of discovery controllers (NVMe TP-8009).

The discovery service will listen for the mDNS discovery events from the
Avahi-daemon and will connect to the newly learnt discovery controllers.
Then the discovery service will automatically attach to any subsystem found in the
discovery log page from the discovery controllers learnt using mDNS.
When determining a controller name to use when attaching, it will use
the 'name' parameter as a prefix, followed by a unique integer assigned for each of the
discovery controllers learnt through mDNS, followed by a unique integer for that discovery
service. If the discovery service identifies a subsystem that has been previously
attached but is listed with a different path, it will use the same controller name
as the previous entry, and connect as a multipath.

When the discovery service sees that a subsystem entry has been removed
from the log page, it will automatically detach from that controller as well.

The 'name' is also used to later stop the discovery service.

#### Parameters

{{ bdev_nvme_start_mdns_discovery_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_start_mdns_discovery",
  "id": 1,
  "params": {
    "name": "cdc_auto",
    "svcname": "_nvme-disc._tcp",
    "hostnqn": "nqn.2021-12.io.spdk:host1"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_stop_mdns_discovery {#rpc_bdev_nvme_stop_mdns_discovery}

Stops a mDNS discovery service. This includes detaching any controllers that were
discovered via the service that is being stopped.

#### Parameters

{{ bdev_nvme_stop_mdns_discovery_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_stop_mdns_discovery",
  "id": 1,
  "params": {
    "name": "cdc_auto"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_nvme_get_mdns_discovery_info {#rpc_bdev_nvme_get_mdns_discovery_info}

Get the information about the mDNS discovery service instances.

#### Parameters

{{ bdev_nvme_get_mdns_discovery_info_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_nvme_get_mdns_discovery_info",
  "id": 1
}
~~~

Example response:

~~~json
[
  {
    "name": "cdc_auto",
    "svcname": "_nvme-disc._tcp",
    "referrals": [
      {
        "name": "cdc_auto0",
        "trid": {
          "trtype": "TCP",
          "adrfam": "IPv4",
          "traddr": "66.1.2.21",
          "trsvcid": "8009",
          "subnqn": "nqn.2014-08.org.nvmexpress.discovery"
        }
      },
      {
        "name": "cdc_auto1",
        "trid": {
          "trtype": "TCP",
          "adrfam": "IPv4",
          "traddr": "66.1.1.21",
          "trsvcid": "8009",
          "subnqn": "nqn.2014-08.org.nvmexpress.discovery"
        }
      }
    ]
  }
]
~~~

### nvmf_publish_mdns_prr {#rpc_nvmf_publish_mdns_prr}

This interface is used to publish an NVMf target's service location using mDNS
(Multicast DNS) protocol. It allows clients to discover the NVMf target using
the published service location.

#### Parameters

{{ nvmf_publish_mdns_prr_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "nvmf_publish_mdns_prr",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### nvmf_stop_mdns_prr {#rpc_nvmf_stop_mdns_prr}

This interface is used to stop publishing the NVMf target's service location
using mDNS (Multicast DNS) protocol. It removes the published service location,
preventing clients from discovering the NVMf target.

#### Parameters

{{ nvmf_stop_mdns_prr_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "nvmf_stop_mdns_prr",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

## fsdev {#jsonrpc_components_fsdev}

### fsdev_get_opts {#rpc_fsdev_get_opts}

Get fsdev module options.

#### Parameters

{{ fsdev_get_opts_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "fsdev_get_opts",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "fsdev_io_pool_size": 65535,
    "fsdev_io_cache_size": 256
  }
}
~~~

### fsdev_set_opts {#rpc_fsdev_set_opts}

Set fsdev module options.

#### Parameters

{{ fsdev_set_opts_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "fsdev_get_opts",
  "id": 1,
  "params": {
    "fsdev_io_pool_size": 65535,
    "fsdev_io_cache_size": 256
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "fsdev_io_pool_size": 65535,
    "fsdev_io_cache_size": 256
  }
}
~~~

### fsdev_aio_create {#rpc_fsdev_aio_create}

Create an AIO fsdev.

#### Parameters

{{ fsdev_aio_create_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "fsdev_aio_create",
  "id": 8,
  "params": {
    "name": "aio0",
    "root_path": "/tmp/vfio-test",
    "enable_xattr": false,
    "enable_writeback_cache": true,
    "max_write": 65535,
    "skip_rw": true
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 8,
  "result": "aio0"
}
~~~

### fsdev_aio_delete {#rpc_fsdev_aio_delete}

Delete an AIO fsdev.

#### Parameters

{{ fsdev_aio_delete_params }}

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "fsdev_aio_delete",
  "id": 1,
  "params": {
    "name": "aio0"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~
